ZFS statfs problem

Alexander Zagrebin alexz at visp.ru
Fri Oct 30 07:06:16 UTC 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-zfs_vfsops.c
Type: application/octet-stream
Size: 1122 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20091030/1b5fd8bc/patch-zfs_vfsops.obj


More information about the freebsd-fs mailing list