[PATCH 03/11] quota: add quota format lock

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

 



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

Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxx>
---
 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

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