> Steve Lord wrote:
>
> So explain how this is supposed to work.
Let me see if I can better explain what I'm trying to do. This way, if I
have a glaring misconception, some one can point it out.
I'll trace what I want to do through the xfs_create path.
Background:
- xfs filesystem with user and qroup quotas enabled. Both accounting and
enforcement are enabled.
- Default quotas set in root user quota for a particular filesystem.
- user1 copies a file from their local drive to the shared drive that has
the quotas on it.
What happens regarding quotas: (the way I read it starting at xfs_create)
- xfs_create is called.
- if quotas are on the mountpoint then call xfs_qm_vop_dqalloc.
(xfs_vnodeops.c:2197)
- attach the dquots (user and group) the the inode and allocate dquots if
necessary. (xfs_qm.c:2532)
- call xfs_qm_dqget without the inode in order to get the uid dquot.
Allocate if necessary. (xfs_qm.c:2553)
- repeat for the group quota. (xfs_qm.c:2583)
- return the user and group quotas.
- call xfs_trans_reserve_quota which is typedefed to
xfs_trans_reserve_quota_bydquots in xfs_quota.h:307. (xfs_vnodeops.c:2278)
- call xfs_trans_dqresv and verify that we can reserve the number of blocks
or inodes that we need to without exceeding quota. It is at this point that
I would like to use user1's hardlimit as the hardlimit if they have a limit
and root's hardlimit if user1's hardlimit is 0. I don't want to change how
the accounting takes place, I just want access to an alternate set of
enforcement criteria.
- If we can't reserve the number of blocks needed for the write because
hardlimit has been exceeded, return EDQUOT. If we can, go ahead and do your
mojo.
> Each user has a quota structure,
> an xfs_dquot_t which is looked up via xfs_qm_dqget. This is the in
> memory representation of a user's quota. If quotas are not defined for
> a specific user then there is no structure, and nothing happens with
> quotas. So you are trying to implement default quotas for accounts
> the administrator did not configure one for. Where does the
> quota space
> used get recorded, do all user's without a specific quota get to share
> one pool of quota space?
I was under the assumption that a dquot is allocated to disk if one isn't
found for that user. That appears to be what is happening when xfs_qm_dqget
is called. It eventually calls xfs_qm_idtodq which allocates a dquot and
then reads it. I don't understand why a dquot wouldn't exist just because
there isn't a [hard,soft,inode]limit set for a particular uid when they own
files on filesystem.
Cary
|