[PATCH 2/8] Change stv_fsspace to be stv_fssize
Martin Blix Grydeland
martin at varnish-software.com
Mon Oct 6 17:50:05 CEST 2014
Calculate the total size of the file system instead of how much space
is available
---
bin/varnishd/storage/stevedore_utils.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/bin/varnishd/storage/stevedore_utils.c b/bin/varnishd/storage/stevedore_utils.c
index e30cbcc..ccb0614 100644
--- a/bin/varnishd/storage/stevedore_utils.c
+++ b/bin/varnishd/storage/stevedore_utils.c
@@ -133,25 +133,25 @@ STV_GetFile(const char *fn, int *fdp, const char **fnp, const char *ctx)
}
/*--------------------------------------------------------------------
- * Figure out how much space is in a filesystem
+ * Figure out the block size and total size of the filesystem
*/
static uintmax_t
-stv_fsspace(int fd, unsigned *bs)
+stv_fssize(int fd, unsigned *bs)
{
- uintmax_t bsize, bavail;
+ uintmax_t bsize, blocks;
#if defined(HAVE_SYS_STATVFS_H)
struct statvfs fsst;
AZ(fstatvfs(fd, &fsst));
bsize = fsst.f_frsize;
- bavail = fsst.f_bavail;
+ blocks = fsst.f_blocks;
#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;
+ blocks = fsst.f_blocks;
#else
#error no struct statfs / struct statvfs
#endif
@@ -160,7 +160,7 @@ stv_fsspace(int fd, unsigned *bs)
if (*bs < bsize)
*bs = bsize;
XXXAZ(*bs % bsize);
- return (bsize * bavail);
+ return (bsize * blocks);
}
@@ -187,7 +187,7 @@ STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx)
xxxassert(S_ISREG(st.st_mode));
bs = *granularity;
- fssize = stv_fsspace(fd, &bs);
+ fssize = stv_fssize(fd, &bs);
XXXAZ(bs % *granularity);
if ((size == NULL || *size == '\0') && st.st_size != 0) {
--
2.1.1
More information about the varnish-dev
mailing list