quotactl returns double values

Mike Pritchard mpp at mail.mppsystems.com
Mon Feb 11 00:39:45 UTC 2008


On Sun, Feb 10, 2008 at 01:04:24PM +0900, Tod McQuillin wrote:
> On Sat, 9 Feb 2008, Ivan Georgiev wrote:
> 
> >I was just playing, trying to see how quotactl works,
> >but in all my tries the values returned are doubled,
> >
> >the values stored in my_st->dqb_bhardlimit and my_st->dqb_curblocks
> >are the real values times two, the hard limit on the user is 102400K,
> >but my_st->dqb_bhardlimit holds 204800K.
> 
> I hope you are remembering that the limits are measured in blocks -- a block is 
> 512 bytes.
> 
> Thus a limit of 102400K is 204800 blocks, since each 1K holds 2 blocks.

You can also use "quota -r" to dump out the raw quota data.

Simple answer is, internally the quota system maintains its block counts 
by counting the # of blocks that would be returned by stat(2) in the
st_blocks field, which is the # of 512-byte blocks used by the file.
Externally, (e.g. what it displays, takes as input) is 1024-byte blocks counts.
-- 
Mike Pritchard
mpp @ FreeBSD.org
"If tyranny and oppression come to this land, it will be in the guise
of fighting a foreign enemy."  - James Madison (1787)


More information about the freebsd-hackers mailing list