[PATCH 3/4] Use VFIL_fallocate in -sfile

Martin Blix Grydeland martin at varnish-software.com
Mon Oct 6 17:53:14 CEST 2014


---
 bin/varnishd/storage/storage_file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/varnishd/storage/storage_file.c b/bin/varnishd/storage/storage_file.c
index db634f2..0102302 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
@@ -40,6 +40,7 @@
 #include "storage/storage.h"
 
 #include "vnum.h"
+#include "vfil.h"
 
 #ifndef MAP_NOCORE
 #define MAP_NOCORE 0 /* XXX Linux */
@@ -108,6 +109,8 @@ smf_initfile(struct smf_sc *sc, const char *size)
 	    "-sfile");
 
 	AZ(ftruncate(sc->fd, (off_t)sc->filesize));
+	if (VFIL_fallocate(sc->fd, (off_t)sc->filesize))
+		ARGV_ERR("(-sfile) %s\n", strerror(errno));;
 
 	/* XXX: force block allocation here or in open ? */
 }
-- 
2.1.1




More information about the varnish-dev mailing list