Commit 955bc6b7 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

In struct statvfs, f_bsize is not the block size (i.e. the granularity

of f_bavail), but the recommended I/O granularity.  The field we want
is f_frsize.  This should probably be abstracted away in libvarnish.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4022 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent e1e30a80
......@@ -140,23 +140,28 @@ STV_GetFile(const char *fn, int *fdp, const char **fnp, const char *ctx)
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment