linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>, tytso <tytso@mit.edu>,
	linux-ext4 <linux-ext4@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH V4 2/3] quota: Add quota claim and release reserved quota blocks operations
Date: Mon, 05 Jan 2009 20:32:43 -0800	[thread overview]
Message-ID: <1231216363.9267.9.camel@mingming-laptop> (raw)
In-Reply-To: <20081215134016.GD15464@duck.suse.cz>

Hi Jan,

Thanks for your comments. Sorry for the late the response while holiday
in the way.

在 2008-12-15一的 14:40 +0100,Jan Kara写道:
> Hi Mingming,
> 
>   sorry I spoke to soon in my previous email. You tried to resolve the
> issue with dquot_transfer(). I just thought it would belong to the first
> patch...
> 
> On Fri 12-12-08 12:47:40, Mingming Cao wrote:
> > quota: Add quota reservation claim and released operations
> > 
> > Reserved quota will be claimed at the block allocation time. Over-booked
> > quota could be returned back with the release callback function.
> > 
> > Signed-off-by: Mingming Cao <cmm@us.ibm.com>
> > ---
> >  fs/dquot.c               |  101 +++++++++++++++++++++++++++++++++++++++++++++--
> >  include/linux/quota.h    |    4 +
> >  include/linux/quotaops.h |   53 ++++++++++++++++++++++++
> >  3 files changed, 153 insertions(+), 5 deletions(-)
> > 
>   <snip>
> 
> > Index: linux-2.6.28-rc2/fs/dquot.c
> > ===================================================================
> > --- linux-2.6.28-rc2.orig/fs/dquot.c	2008-12-12 12:20:45.000000000 -0800
> > +++ linux-2.6.28-rc2/fs/dquot.c	2008-12-12 12:21:49.000000000 -0800
>   <snip>
> 
> > @@ -1448,7 +1532,8 @@ int dquot_free_inode(const struct inode 
> >   */
> >  int dquot_transfer(struct inode *inode, struct iattr *iattr)
> >  {
> > -	qsize_t space;
> > +	qsize_t space, cur_space;
> > +	qsize_t rsv_space = 0;
> >  	struct dquot *transfer_from[MAXQUOTAS];
> >  	struct dquot *transfer_to[MAXQUOTAS];
> >  	int cnt, ret = NO_QUOTA, chuid = (iattr->ia_valid & ATTR_UID) && inode->i_uid != iattr->ia_uid,
> > @@ -1489,12 +1574,16 @@ int dquot_transfer(struct inode *inode, 
> >  		}
> >  	}
> >  	spin_lock(&dq_data_lock);
> > -	space = inode_get_bytes(inode);
> > +	space = cur_space = inode_get_bytes(inode);
> >  	/* Build the transfer_from list and check the limits */
> >  	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
> >  		if (transfer_to[cnt] == NODQUOT)
> >  			continue;
> >  		transfer_from[cnt] = inode->i_dquot[cnt];
> > +		if (!rsv_space) {
> > +			rsv_space = transfer_from[cnt]->dq_dqb.dqb_rsvspace;
> > +			space += rsv_space;
>   Hmm, but you cannot simply transfer all the reserved space from one user
> to another. You have to transfer just the amount reserved for this inode
> (i.e. EXT4_I(inode)->i_reserved_data_blocks +
> EXT4_I(inode)->i_reserved_meta_blocks). The fact is this is not available
> to quota code. One possibility is to store this number in VFS inode (which I
> guess people would not like because it would increase every inode size by 8
> bytes). So probably more plausible is to provide a callback so that quota
> code can find out how much space this inode has reserved. This is not a
> performance critical operation so the cost of the function call is
> acceptable here IMO.
> 


You are right,  that's what I was misunderstand before. I will send out
updated quota patches.


Mingming
> > +		}
> >  		if (check_idq(transfer_to[cnt], 1, warntype_to + cnt) ==
> >  		    NO_QUOTA || check_bdq(transfer_to[cnt], space, 0,
> >  		    warntype_to + cnt) == NO_QUOTA)
> > @@ -1518,11 +1607,13 @@ int dquot_transfer(struct inode *inode, 
> >  			warntype_from_space[cnt] =
> >  				info_bdq_free(transfer_from[cnt], space);
> >  			dquot_decr_inodes(transfer_from[cnt], 1);
> > -			dquot_decr_space(transfer_from[cnt], space);
> > +			dquot_decr_space(transfer_from[cnt], cur_space);
> > +			dquot_free_reserved_space(transfer_from[cnt], rsv_space);
> >  		}
> >  
> >  		dquot_incr_inodes(transfer_to[cnt], 1);
> > -		dquot_incr_space(transfer_to[cnt], space);
> > +		dquot_incr_space(transfer_to[cnt], cur_space);
> > +		dquot_resv_space(transfer_to[cnt], rsv_space);
> >  
> >  		inode->i_dquot[cnt] = transfer_to[cnt];
> >  	}
> 
> 								Honza

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2009-01-06  4:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12 20:47 [PATCH V4 2/3] quota: Add quota claim and release reserved quota blocks operations Mingming Cao
2008-12-15 13:40 ` Jan Kara
2009-01-06  4:32   ` Mingming Cao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1231216363.9267.9.camel@mingming-laptop \
    --to=cmm@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).