Re: [PATCH 4/5] quota: Move duplicated code to separate functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux