Hello Eric, Friday, June 9, 2006, 5:06:49 PM, you wrote:
ES> On Thu, Jun 08, 2006 at 10:53:06PM -0500, Spencer Shepler wrote: >> >> On Thu, Eric Schrock wrote: >> > The problem is that statvfs() only returns two values (total blocks and >> > free blocks) from which we have to calculate three values: size, free, >> >> ? >> >> >From statvfs(2) the following are returned in struct statvfs: >> >> fsblkcnt_t f_blocks; /* total # of blocks on file system >> in units of f_frsize */ >> fsblkcnt_t f_bfree; /* total # of free blocks */ >> fsblkcnt_t f_bavail; /* # of free blocks avail to >> >> So, the data is being passed back. Is there something I am missing? ES> Yes, because these values aren't as straightforward as they seem. For ES> example, consider the return values from UFS: ES> $ truss -t statvfs -v statvfs df -h / ES> statvfs64("/", 0x080479BC) = 0 ES> bsize=8192 frsize=1024 blocks=8068757 bfree=2258725 ES> bavail=2178038 files=972608 ffree=809612 favail=809612 ES> fsid=0x1980000 basetype=ufs namemax=255 ES> flag=ST_NOTRUNC ES> fstr="" ES> Filesystem size used avail capacity Mounted on ES> /dev/dsk/c1d0s0 7.7G 5.5G 2.1G 73% / ES> $ ES> Notice that the values don't correspond to your assumption. In ES> particular, 'bfree + bavail != blocks'. The two values for 'bfree' and ES> 'bavail' are used for filesystems that have a notion of 'reserved' ES> blocks, i.e. metadata blocks which are used by the filesystem but not ES> available to the user in the form of free space. That's why you have ES> two values, and if you look at the source code for df(1), you'll see ES> that it never uses 'bfree' (except in rare internal calculations) ES> because it's basically useless. >> So, from the comments, that bit of df code seems to be adjusting >> for quotas if they exist? I am not sure I understand why >> zfs' VFS_STATVFS() function can't do what the df command is doing >> and then return the appropriate value to both df and the NFS server? >> >> So, in Robert's case, is that 17GB really available and if so that >> would seem to be an important thing to report to the NFS clients. ES> Because as mentioned above, 'free' and 'avail' are really variations on ES> the same theme. And ZFS _must_ report them as the same value (because ES> metadata is accounted in the same way as data), so we're constrained by ES> the POSIX interface. I haven't been looking into a code (no time lately) but what I'm most concerned is reported SIZE of a filesystem as it's beeing reported smaller than it actually is. If snapshots reffered space would be accounted to free/available space of a filesystem it would be ok. But changing disk size just because we use snapshots is strange at least. But probably I'm still missing something. Or maybe at least on Solaris<->Solaris we could make it right as someone else suggested? -- Best regards, Robert mailto:[EMAIL PROTECTED] http://milek.blogspot.com _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss