On 21 September, 2009 - Chris Banal sent me these 4,4K bytes:
> It appears as though zfs reports the size of a directory to be one byte per
> file. Traditional file systems such as ufs or ext3 report the actual size
of
> the data needed to store the directory.
Or rather, "the size needed at some random point in time" .. because
it
seldom shrinks when you remove files.. At least not on UFS.. So
basically it''s an uninteresting and stale piece of information. The
number of entries in the directory is much more useful.
> This causes some trouble with the default behavior of some nfs clients
> (linux) to decide to to use a readdirplus call when directory contents are
> small vs a readdir call when the contents are large. We''ve found
this
> particularly troublesome with Maildir style mail folders. The speedup by
not
> using readdirplus is a factor of 100 in this particular situation. While we
> have a work around it would seem that this non-standard behavior might
cause
> trouble for others and in other areas. Are there any suggestions for
dealing
> with this difference and/or why zfs does not represent its directory sizes
> in a more traditional manner?
This has been discussed before regarding software that totally broke
(segfault) with ZFS''s reporting.. The POSIX spec says nothing about
what
size on directories should be, iirc.. Other (Novell I think?)
filesystems has used the same size reporting as well..
> >From the linux kernel source.
>
> ./fs/nfs/inode.c:#define NFS_LIMIT_READDIRPLUS (8*PAGE_SIZE)
Basically, it''s an assumption given informativen given in an
unspecified
format.. Since there is nothing else to go on, it''s not a totally
crappy
assumption, but it doesn''t work all the time either..
Hrm.
> ie. ZFS
>
> zfshost:~/testdir> ls -1 | wc -l
> 330
> zfshost:~/testdir> stat .
> File: `.''
> Size: 332 Blocks: 486 IO Block: 32768 directory
> Device: 29h/41d Inode: 540058 Links: 2
> Access: (0775/drwxrwxr-x) Uid: ( 2891/ banal) Gid: ( 101/ film)
> Access: 2008-11-05 18:40:16.000000000 -0800
> Modify: 2009-09-01 16:09:52.782674099 -0700
> Change: 2009-09-01 16:09:52.782674099 -0700
>
> ie. ext3
>
> ext3host:~/testdir> ls -1 | wc -l
> 330
> ext3host:~/testdir> stat .
> File: `.''
> Size: 36864 Blocks: 72 IO Block: 4096 directory
> Device: 807h/2055d Inode: 23887981 Links: 2
> Access: (0775/drwxrwxr-x) Uid: ( 2891/ banal) Gid: ( 101/ film)
> Access: 2009-09-21 13:44:00.000000000 -0700
> Modify: 2009-09-21 13:44:31.000000000 -0700
> Change: 2009-09-21 13:44:31.000000000 -0700
>
> Thanks,
> Chris
> _______________________________________________
> zfs-discuss mailing list
> zfs-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
/Tomas
--
Tomas ?gren, stric at acc.umu.se, http://www.acc.umu.se/~stric/
|- Student at Computing Science, University of Ume?
`- Sysadmin at {cs,acc}.umu.se