linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-fsdevel@vger.kernel.org
Cc: jack@suse.cz, hch@infradead.org, Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 07/19] quota: add quota format lock
Date: Thu, 11 Nov 2010 15:14:26 +0300	[thread overview]
Message-ID: <1289477678-5669-8-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1289477678-5669-1-git-send-email-dmonakhov@openvz.org>

Currently  dq_list_lock is responsible for quota format protection
which is counter productive. Introduce dedicated lock.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/quota/dquot.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index a1efacd..f719a6f 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -82,7 +82,6 @@
 
 /*
  * There are three quota SMP locks. dq_list_lock protects all lists with quotas
- * and quota formats.
  * dq_data_lock protects data from dq_dqb and also mem_dqinfo structures and
  * also guards consistency of dquot->dq_dqb with inode->i_blocks, i_bytes.
  * i_blocks and i_bytes updates itself are guarded by i_lock acquired directly
@@ -125,6 +124,7 @@
  */
 
 static __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_list_lock);
+static __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_fmt_lock);
 __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_data_lock);
 EXPORT_SYMBOL(dq_data_lock);
 
@@ -155,10 +155,10 @@ static struct kmem_cache *dquot_cachep;
 
 int register_quota_format(struct quota_format_type *fmt)
 {
-	spin_lock(&dq_list_lock);
+	spin_lock(&dq_fmt_lock);
 	fmt->qf_next = quota_formats;
 	quota_formats = fmt;
-	spin_unlock(&dq_list_lock);
+	spin_unlock(&dq_fmt_lock);
 	return 0;
 }
 EXPORT_SYMBOL(register_quota_format);
@@ -167,13 +167,13 @@ void unregister_quota_format(struct quota_format_type *fmt)
 {
 	struct quota_format_type **actqf;
 
-	spin_lock(&dq_list_lock);
+	spin_lock(&dq_fmt_lock);
 	for (actqf = &quota_formats; *actqf && *actqf != fmt;
 	     actqf = &(*actqf)->qf_next)
 		;
 	if (*actqf)
 		*actqf = (*actqf)->qf_next;
-	spin_unlock(&dq_list_lock);
+	spin_unlock(&dq_fmt_lock);
 }
 EXPORT_SYMBOL(unregister_quota_format);
 
@@ -181,14 +181,14 @@ static struct quota_format_type *find_quota_format(int id)
 {
 	struct quota_format_type *actqf;
 
-	spin_lock(&dq_list_lock);
+	spin_lock(&dq_fmt_lock);
 	for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id;
 	     actqf = actqf->qf_next)
 		;
 	if (!actqf || !try_module_get(actqf->qf_owner)) {
 		int qm;
 
-		spin_unlock(&dq_list_lock);
+		spin_unlock(&dq_fmt_lock);
 		
 		for (qm = 0; module_names[qm].qm_fmt_id &&
 			     module_names[qm].qm_fmt_id != id; qm++)
@@ -197,14 +197,14 @@ static struct quota_format_type *find_quota_format(int id)
 		    request_module(module_names[qm].qm_mod_name))
 			return NULL;
 
-		spin_lock(&dq_list_lock);
+		spin_lock(&dq_fmt_lock);
 		for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id;
 		     actqf = actqf->qf_next)
 			;
 		if (actqf && !try_module_get(actqf->qf_owner))
 			actqf = NULL;
 	}
-	spin_unlock(&dq_list_lock);
+	spin_unlock(&dq_fmt_lock);
 	return actqf;
 }
 
-- 
1.6.5.2


  parent reply	other threads:[~2010-11-11 12:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 12:14 [PATCH 00/19] quota: RFC SMP improvements for generic quota V3 Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 01/19] quota: protect getfmt call with dqonoff_mutex lock Dmitry Monakhov
2010-11-11 13:36   ` Christoph Hellwig
2010-11-22 19:35   ` Jan Kara
2010-12-02 11:40     ` Dmitry
2010-11-11 12:14 ` [PATCH 02/19] kernel: add bl_list Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 03/19] quota: Wrap common expression to helper function Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 04/19] quota: protect dqget() from parallels quotaoff via SRCU Dmitry Monakhov
2010-11-22 21:21   ` Jan Kara
2010-11-22 21:53     ` Dmitry
2010-11-11 12:14 ` [PATCH 05/19] quota: mode quota internals from sb to quota_info Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 06/19] quota: Remove state_lock Dmitry Monakhov
2010-11-22 21:12   ` Jan Kara
2010-11-22 21:31     ` Dmitry
2010-11-23 10:55       ` Jan Kara
2010-11-23 11:33         ` Jan Kara
2010-11-11 12:14 ` Dmitry Monakhov [this message]
2010-11-11 12:14 ` [PATCH 08/19] quota: make dquot lists per-sb Dmitry Monakhov
2010-11-22 21:37   ` Jan Kara
2010-11-11 12:14 ` [PATCH 09/19] quota: optimize quota_initialize Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 10/19] quota: user per-backet hlist lock for dquot_hash Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 11/19] quota: remove global dq_list_lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 12/19] quota: rename dq_lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 13/19] quota: make per-sb dq_data_lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 14/19] quota: protect dquot mem info with object's lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 15/19] quota: drop dq_data_lock where possible Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 16/19] quota: relax dq_data_lock dq_lock locking consistency Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 17/19] quota: Some stylistic cleanup for dquot interface Dmitry Monakhov
2010-11-23 11:37   ` Jan Kara
2010-11-11 12:14 ` [PATCH 18/19] fs: add unlocked helpers Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 19/19] quota: protect i_dquot with i_lock instead of dqptr_sem Dmitry Monakhov
2010-11-19  5:44 ` [PATCH 00/19] quota: RFC SMP improvements for generic quota V3 Dmitry

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=1289477678-5669-8-git-send-email-dmonakhov@openvz.org \
    --to=dmonakhov@openvz.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --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).