Re: Quotas: How to count raw blocks?

Jan Kara (jack@atrey.karlin.mff.cuni.cz)
Fri, 8 Oct 1999 15:18:15 +0200


> Hi, are there any quota gurus around?
No ;-).
>
> I'm allocating a couple of raw disk blocks on ext2. Currently,
> quotas are ignored. What's the recommended strategy to count
> these blocks?
>
> In additon, these blocks are shared among potentially many users.
> Is there any agreed-upon way to account for this?
Quota takes care only about blocks attached to some inode. If this is
the case you can use DQUOT_ALLOC_BLOCK() as defined in include/linux/quotaops.h.
The blocks will be accounted to owning user and group. There is no legal way
in current system you can account one block to more than one user or
more than one group. If blocks aren't attached to any inode there is
neither any legal way to account this. But you can do a dirty hack and just
gain a proper quota structure from dqget() (defined in fs/dquot.c), update
the dq_dqb.dqb_curblocks (do needed checks for exceeding a limits -- see
alloc_alloc_block() in dquot.c), mark dquot dirty and put it through dqput()...

> Any ideas what it takes to make quotacheck count these blocks correctly?
>
> (Currently, it's not even easy to find out how many blocks are
> allocated for a particular user and inode.)
Uhh.. Quotacheck is just userspace tool... It would have to gain somehow
a user list to accout blocks to. I know too few about your problem to decide
how to do this...

Honza.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/