linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] quota:  Move down dqptr_sem read after initializing default warn[] type at __dquot_alloc_space().
@ 2012-07-18  4:12 Jeff Liu
  2012-08-14 13:26 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Liu @ 2012-07-18  4:12 UTC (permalink / raw)
  To: linux-fsdevel@vger.kernel.org; +Cc: Jan Kara

Hello,

sb->s_dqout->dqptr_sem is used to serialize ops using quota_info for pointers from inode to dquots.
But for __dquot_alloc_space(), it could be safely moved down after the default warn[] array got initialized IMHO.

Thanks,
-Jeff


Signed-off-by: Jie Liu <jeff.liu@oracle.com>

---
 fs/quota/dquot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 10cbe84..510ae87 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1571,10 +1571,10 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 		goto out;
 	}
 
-	down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
 		warn[cnt].w_type = QUOTA_NL_NOWARN;
 
+	down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	spin_lock(&dq_data_lock);
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		if (!dquots[cnt])
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] quota:  Move down dqptr_sem read after initializing default warn[] type at __dquot_alloc_space().
  2012-07-18  4:12 [PATCH] quota: Move down dqptr_sem read after initializing default warn[] type at __dquot_alloc_space() Jeff Liu
@ 2012-08-14 13:26 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2012-08-14 13:26 UTC (permalink / raw)
  To: Jeff Liu; +Cc: linux-fsdevel@vger.kernel.org, Jan Kara

  Hello,

On Wed 18-07-12 12:12:41, Jeff Liu wrote:
> sb->s_dqout->dqptr_sem is used to serialize ops using quota_info for pointers from inode to dquots.
> But for __dquot_alloc_space(), it could be safely moved down after the default warn[] array got initialized IMHO.
  Yes, you are right. Although practically the difference will be rather
minimal... Thanks for the patch. I've added it to my tree.

								Honza
> 
> Thanks,
> -Jeff
> 
> 
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> 
> ---
>  fs/quota/dquot.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 10cbe84..510ae87 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -1571,10 +1571,10 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
>  		goto out;
>  	}
>  
> -	down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
>  	for (cnt = 0; cnt < MAXQUOTAS; cnt++)
>  		warn[cnt].w_type = QUOTA_NL_NOWARN;
>  
> +	down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
>  	spin_lock(&dq_data_lock);
>  	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
>  		if (!dquots[cnt])
> -- 
> 1.7.4.1
> 
> 
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-14 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-18  4:12 [PATCH] quota: Move down dqptr_sem read after initializing default warn[] type at __dquot_alloc_space() Jeff Liu
2012-08-14 13:26 ` Jan Kara

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).