From: Andrew Deason Date: Thu, 24 Sep 2009 17:02:55 +0000 (-0500) Subject: Use f_bsize for ZFS afs_fsfragsize X-Git-Tag: openafs-devel-1_5_66~73 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=78d8b8c5c19b8d6873b2d62beaa60cc7acba1840;p=packages%2Fo%2Fopenafs.git Use f_bsize for ZFS afs_fsfragsize On ZFS, the disk space files can use up can be rounded up to the next recordsize boundary if they've been truncated. This can cause the Unix CM to mis-estimate cache usage, since it truncates files fairly often, and assumes the disk space used is the file length rounded up to the next f_frsize. Since the ZFS recordsize is available via the statvfs f_bsize, just round up to that instead. There is still some additional file metadata that takes up some additional space on disk, but according to ZFS people I've spoken to about this, it cannot be known in advance. In practice, the additional metadata storage doesn't appear to exceed about 10% of the data storage, which should be acceptable. FIXES 125365 Reviewed-on: http://gerrit.openafs.org/650 Reviewed-by: Derrick Brashear Tested-by: Andrew Deason --- diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index 2b1cae72a..b55ae7aa0 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -425,7 +425,17 @@ afs_InitCacheInfo(register char *afile) if (!VFS_STATFS(filevp->v_vfsp, &st)) #endif /* SGI... */ #if defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV) - afs_fsfragsize = st.f_frsize - 1; + if (strcmp("zfs", st.f_basetype) == 0) { + /* + * Files in ZFS can take up to around the next + * recordsize boundary after being truncated. recordsize + * is reported in statvfs by f_bsize, so use that + * instead. + */ + afs_fsfragsize = st.f_bsize - 1; + } else { + afs_fsfragsize = st.f_frsize - 1; + } #else afs_fsfragsize = st.f_bsize - 1; #endif