Olivier Nicole <[email protected]> writes:
> After some diging I have the answer.
>
> On FreeBSD, from the man page of fstatvfs:
>
>            f_bsize    The preferred length of I/O requests for files on this
>                       file system.  (Corresponds to the f_iosize member of
>                       struct statfs.)

Yes, we should use f_frsize instead.  Please try the attached patch.

> $ a.out
> 16384 2297104

I imagine this is the stripe size of your array?

DES
-- 
Dag-Erling Smørgrav - [email protected]

Index: bin/varnishd/stevedore_utils.c
===================================================================
--- bin/varnishd/stevedore_utils.c	(revision 4020)
+++ bin/varnishd/stevedore_utils.c	(working copy)
@@ -140,23 +140,28 @@
 static uintmax_t
 stv_fsspace(int fd, unsigned *bs)
 {
+	uintmax_t bsize, bavail;
 #if defined(HAVE_SYS_STATVFS_H)
 	struct statvfs fsst;
 
 	AZ(fstatvfs(fd, &fsst));
+	bsize = fsst.f_frsize;
+	bavail = fsst.f_bavail;
 #elif defined(HAVE_SYS_MOUNT_H) || defined(HAVE_SYS_VFS_H)
 	struct statfs fsst;
 
 	AZ(fstatfs(sc->fd, &fsst));
+	bsize = fsst.f_bsize;
+	bavail = fsst.f_bavail;
 #else
 #error no struct statfs / struct statvfs
 #endif
 
 	/* We use units of the larger of filesystem blocksize and pagesize */
-	if (*bs < fsst.f_bsize)
-		*bs = fsst.f_bsize;
-	xxxassert(*bs % fsst.f_bsize == 0);
-	return (fsst.f_bsize * fsst.f_bavail);
+	if (*bs < bsize)
+		*bs = bsize;
+	xxxassert(*bs % bsize == 0);
+	return (bsize * bavail);
 }
 
 
_______________________________________________
varnish-misc mailing list
[email protected]
http://projects.linpro.no/mailman/listinfo/varnish-misc

Reply via email to