linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 4/5] quota: Move duplicated code to separate functions
Date: Mon, 14 Dec 2009 19:00:36 +0100	[thread overview]
Message-ID: <20091214180036.GG4731@quack.suse.cz> (raw)
In-Reply-To: <1260793276-8511-4-git-send-email-dmonakhov@openvz.org>

On Mon 14-12-09 15:21:15, Dmitry Monakhov wrote:
> - for(..) { mark_dquot_dirty(); }  -> mark_all_dquot_dirty()
> - for(..) { dput_all(); }          -> dqput_all()
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  fs/quota/dquot.c |   75 ++++++++++++++++++++++++++----------------------------
>  1 files changed, 36 insertions(+), 39 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 942ea0b..d6d535c 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -327,6 +327,28 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)
>  }
>  EXPORT_SYMBOL(dquot_mark_dquot_dirty);
>  
> +/* Dirtify all the dquots - this can block when journalling */
> +static inline int mark_all_dquot_dirty(struct dquot **dquot)
> +{
> +	int ret, err, cnt;
  Added empty line here.
> +	ret = err = 0;
> +	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
> +		if (dquot[cnt])
> +			/* Even in case of error we have to continue */
> +			ret = mark_dquot_dirty(dquot[cnt]);
> +		if (!err)
> +			err = ret;
> +	}
> +	return err;
> +}
> +
> +static inline void dqput_all(struct dquot **dquot)
> +{
> +	unsigned int cnt;
  Added empty line here.
> +	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
> +		dqput(dquot[cnt]);
> +}
...
> @@ -1569,10 +1585,7 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number)
>  warn_put_all:
>  	spin_unlock(&dq_data_lock);
>  	if (ret == QUOTA_OK)
> -		/* Dirtify all the dquots - this can block when journalling */
> -		for (cnt = 0; cnt < MAXQUOTAS; cnt++)
> -			if (inode->i_dquot[cnt])
> -				mark_dquot_dirty(inode->i_dquot[cnt]);
> +		mark_all_dquot_dirty((struct dquot **)inode->i_dquot);
  Removed the typecast here.

> @@ -1706,10 +1713,7 @@ int dquot_free_inode(const struct inode *inode, qsize_t number)
>  		dquot_decr_inodes(inode->i_dquot[cnt], number);
>  	}
>  	spin_unlock(&dq_data_lock);
> -	/* Dirtify all the dquots - this can block when journalling */
> -	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
> -		if (inode->i_dquot[cnt])
> -			mark_dquot_dirty(inode->i_dquot[cnt]);
> +	mark_all_dquot_dirty((struct dquot **)inode->i_dquot);
  Removed the typecast here.

...
  Merged the patch into my tree. Thanks.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  parent reply	other threads:[~2009-12-14 18:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-14 12:21 [PATCH 1/5] Add unlocked version of inode_add_bytes() function Dmitry Monakhov
2009-12-14 12:21 ` [PATCH 2/5] quota: decouple fs reserved space from quota reservation. [V5] Dmitry Monakhov
2009-12-14 12:21   ` [PATCH 3/5] ext4: Convert to generic reserved quota's space management. [V5] Dmitry Monakhov
2009-12-14 12:21     ` [PATCH 4/5] quota: Move duplicated code to separate functions Dmitry Monakhov
2009-12-14 12:21       ` [PATCH 5/5] quota: handle IO errors in dquot_transfer() Dmitry Monakhov
2009-12-14 18:41         ` Jan Kara
2009-12-14 22:43           ` Dmitry Monakhov
2009-12-15 11:49             ` Jan Kara
2009-12-14 18:00       ` Jan Kara [this message]
2009-12-14 14:35     ` [PATCH 3/5] ext4: Convert to generic reserved quota's space management. [V5] tytso
2009-12-14 17:26       ` Jan Kara
2009-12-14 17:25     ` Jan Kara
2009-12-14 17:24   ` [PATCH 2/5] quota: decouple fs reserved space from quota reservation. [V5] Jan Kara
2009-12-14 17:21 ` [PATCH 1/5] Add unlocked version of inode_add_bytes() function 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=20091214180036.GG4731@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=dmonakhov@openvz.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 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).