Date: Fri, 30 Oct 2009 09:50:36 +0300 From: "Alexander Zagrebin" <alexz@visp.ru> To: <freebsd-fs@freebsd.org> Subject: ZFS statfs problem Message-ID: <656C9ACD24DB41898D89F64DC7A2E3E1@vosz.local>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi! I have noticed, that statfs called for ZFS file systems, returns the value of fs's recordsize property in both f_bsize and f_iosize. It's a problem for some software. For example, squid uses block size of cache's file system to calculate the space occupied by file. So it considers that any small file uses 128KB of a cache (when default value of recordsize is used), though really this file may use 512B only. This miscalculation generates unjustified cleaning of a cache. There are the some possible solutions: - to set recordsize to lower value (for example, 2K), but it's not optimal for file system. - to force squid to use 512 as block size (via patch) - to change the zfs code (zfs_vfsops.c) to return 512 as f_bsize and recordsize as f_iosize (see attached patch for 8.0-RC1) I think that the last solution is more correct. The patch seems to be working, but i'm not sure that it's correct. Would you comment this? -- Alexander Zagrebin [-- Attachment #2 --] --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c.orig 2009-09-29 14:53:06.000000000 +0400 +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c 2009-10-26 15:47:29.365783209 +0300 @@ -214,7 +214,7 @@ newval = SPA_MAXBLOCKSIZE; zfsvfs->z_max_blksz = newval; - zfsvfs->z_vfs->vfs_bsize = newval; + zfsvfs->z_vfs->mnt_stat.f_iosize = newval; } static void @@ -577,7 +577,8 @@ if (error = dsl_prop_get_integer(osname, "recordsize", &recordsize, NULL)) goto out; - zfsvfs->z_vfs->vfs_bsize = recordsize; + zfsvfs->z_vfs->vfs_bsize = SPA_MINBLOCKSIZE; + zfsvfs->z_vfs->mnt_stat.f_iosize = recordsize; vfsp->vfs_data = zfsvfs; vfsp->mnt_flag |= MNT_LOCAL; @@ -817,8 +818,8 @@ * We report the fragsize as the smallest block size we support, * and we report our blocksize as the filesystem's maximum blocksize. */ - statp->f_bsize = zfsvfs->z_vfs->vfs_bsize; - statp->f_iosize = zfsvfs->z_vfs->vfs_bsize; + statp->f_bsize = SPA_MINBLOCKSIZE; + statp->f_iosize = zfsvfs->z_vfs->mnt_stat.f_iosize; /* * The following report "total" blocks of various kinds in the
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?656C9ACD24DB41898D89F64DC7A2E3E1>
