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@gmail.com>
Subject: [PATCH 03/11] quota: add quota format lock
Date: Tue,  5 Oct 2010 22:20:19 +0400	[thread overview]
Message-ID: <1286302827-31043-4-git-send-email-dmonakhov@gmail.com> (raw)
In-Reply-To: <1286302827-31043-1-git-send-email-dmonakhov@gmail.com>

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

Signed-off-by: Dmitry Monakhov <dmonakhov@gmail.com>
---
 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 eddf5cf..5e0b099 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
@@ -128,6 +127,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);
 
@@ -158,10 +158,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);
@@ -170,13 +170,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);
 
@@ -184,14 +184,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++)
@@ -200,14 +200,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.6.1


  parent reply	other threads:[~2010-10-05 18:20 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05 18:20 (unknown), Dmitry Monakhov
2010-10-05 18:20 ` [PATCH 01/11] quota: add wrapper function Dmitry Monakhov
2010-10-06  8:56   ` Christoph Hellwig
2010-10-06 10:01   ` Jan Kara
2010-10-05 18:20 ` [PATCH 02/11] quota: Convert dq_state_lock to per-sb dq_state_lock Dmitry Monakhov
2010-10-06 10:04   ` Jan Kara
2010-10-05 18:20 ` Dmitry Monakhov [this message]
2010-10-06 10:05   ` [PATCH 03/11] quota: add quota format lock Jan Kara
2010-10-05 18:20 ` [PATCH 04/11] quota: make dquot lists per-sb Dmitry Monakhov
2010-10-06  8:57   ` Christoph Hellwig
2010-10-06  9:39     ` Dmitry
2010-10-06 10:22   ` Jan Kara
2010-10-06 10:40     ` Dmitry
2010-10-06 10:54       ` Jan Kara
2010-10-05 18:20 ` [PATCH 05/11] quota: make per-sb hash array Dmitry Monakhov
2010-10-06 10:38   ` Jan Kara
2010-10-05 18:20 ` [PATCH 06/11] quota: remove global dq_list_lock Dmitry Monakhov
2010-10-05 18:20 ` [PATCH 07/11] quota: rename dq_lock Dmitry Monakhov
2010-10-05 18:20 ` [PATCH 08/11] quota: make per-sb dq_data_lock Dmitry Monakhov
2010-10-06 11:01   ` Jan Kara
2010-10-05 18:20 ` [PATCH 09/11] quota: protect dquot mem info with objects's lock Dmitry Monakhov
2010-10-06 12:37   ` Jan Kara
2010-10-06 13:17     ` Dmitry
2010-10-06 13:41       ` Jan Kara
2010-10-06 14:19     ` Dmitry
2010-10-06 13:30   ` Jan Kara
2010-10-06 13:41     ` Dmitry
2010-10-05 18:20 ` [PATCH 10/11] quota: drop dq_data_lock where possible Dmitry Monakhov
2010-10-05 18:20 ` [PATCH 11/11] quota: relax dq_data_lock dq_lock locking consistency Dmitry Monakhov
2010-10-06 11:56   ` Jan Kara
2010-10-06  7:08 ` [PATCH 0/11] RFC quota scalability V1 Dmitry
2010-10-06  9:44   ` Jan Kara
2010-10-06 10:15     ` Dmitry
2010-10-06 10:47       ` Jan Kara
2010-10-10  3:50     ` Brad Boyer

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=1286302827-31043-4-git-send-email-dmonakhov@gmail.com \
    --to=dmonakhov@openvz.org \
    --cc=dmonakhov@gmail.com \
    --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).