From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@infradead.org>
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org, dmonakhov@openvz.org
Subject: Re: [PATCH 1/2] quota: merge __dquot_transfer into dquot_transfer
Date: Mon, 8 Mar 2010 18:11:34 +0100 [thread overview]
Message-ID: <20100308171133.GF5644@quack.suse.cz> (raw)
In-Reply-To: <20100306131753.GA28278@infradead.org>
On Sat 06-03-10 08:17:53, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Christoph, I see that you have removed the 'mask' argument of
dquot_transfer. Actually, this has been added a short time ago as
a preparation for the project_id patches of Dmitry. Since his patches
seem to be getting in a good shape, I'd prefer not to make his life
harder and leave __dquot_transfer as is for now so that he can hook
into it.
Honza
>
> Index: linux-2.6/fs/quota/dquot.c
> ===================================================================
> --- linux-2.6.orig/fs/quota/dquot.c 2010-03-06 12:47:10.086024843 +0100
> +++ linux-2.6/fs/quota/dquot.c 2010-03-06 12:47:42.171272853 +0100
> @@ -1676,8 +1676,10 @@ EXPORT_SYMBOL(dquot_free_inode);
> *
> * This operation can block, but only after everything is updated
> * A transaction must be started when entering this function.
> + *
> + * Called from ->setattr.
> */
> -static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask)
> +int dquot_transfer(struct inode *inode, struct iattr *iattr)
> {
> qsize_t space, cur_space;
> qsize_t rsv_space = 0;
> @@ -1689,18 +1691,23 @@ static int __dquot_transfer(struct inode
>
> /* First test before acquiring mutex - solves deadlocks when we
> * re-enter the quota code and are already holding the mutex */
> - if (IS_NOQUOTA(inode))
> + if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode))
> return 0;
> +
> + dquot_initialize(inode);
> +
> /* Initialize the arrays */
> for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
> transfer_from[cnt] = NULL;
> transfer_to[cnt] = NULL;
> warntype_to[cnt] = QUOTA_NL_NOWARN;
> }
> - for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
> - if (mask & (1 << cnt))
> - transfer_to[cnt] = dqget(inode->i_sb, chid[cnt], cnt);
> - }
> +
> + if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid)
> + transfer_to[USRQUOTA] = dqget(inode->i_sb, iattr->ia_uid, cnt);
> + if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)
> + transfer_to[GRPQUOTA] = dqget(inode->i_sb, iattr->ia_gid, cnt);
> +
> down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
> if (IS_NOQUOTA(inode)) { /* File without quota accounting? */
> up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
> @@ -1775,29 +1782,6 @@ over_quota:
> transfer_from[cnt] = NULL;
> goto warn_put_all;
> }
> -
> -/* Wrapper for transferring ownership of an inode for uid/gid only
> - * Called from FSXXX_setattr()
> - */
> -int dquot_transfer(struct inode *inode, struct iattr *iattr)
> -{
> - qid_t chid[MAXQUOTAS];
> - unsigned long mask = 0;
> -
> - if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) {
> - mask |= 1 << USRQUOTA;
> - chid[USRQUOTA] = iattr->ia_uid;
> - }
> - if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) {
> - mask |= 1 << GRPQUOTA;
> - chid[GRPQUOTA] = iattr->ia_gid;
> - }
> - if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
> - dquot_initialize(inode);
> - return __dquot_transfer(inode, chid, mask);
> - }
> - return 0;
> -}
> EXPORT_SYMBOL(dquot_transfer);
>
> /*
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-03-08 17:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-06 13:17 [PATCH 1/2] quota: merge __dquot_transfer into dquot_transfer Christoph Hellwig
2010-03-08 17:11 ` Jan Kara [this message]
2010-03-08 17:13 ` Christoph Hellwig
2010-03-08 17:39 ` Jan Kara
2010-03-08 17:42 ` Christoph Hellwig
2010-03-08 18:04 ` Jan Kara
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=20100308171133.GF5644@quack.suse.cz \
--to=jack@suse.cz \
--cc=dmonakhov@openvz.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.