From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Monakhov Subject: [PATCH 03/11] quota: add quota format lock Date: Tue, 5 Oct 2010 22:20:19 +0400 Message-ID: <1286302827-31043-4-git-send-email-dmonakhov@gmail.com> References: <1286302827-31043-1-git-send-email-dmonakhov@gmail.com> Cc: jack@suse.cz, hch@infradead.org, Dmitry Monakhov To: linux-fsdevel@vger.kernel.org Return-path: Received: from mail-ey0-f174.google.com ([209.85.215.174]:37647 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753777Ab0JESUz (ORCPT ); Tue, 5 Oct 2010 14:20:55 -0400 Received: by mail-ey0-f174.google.com with SMTP id 6so2592010eyb.19 for ; Tue, 05 Oct 2010 11:20:55 -0700 (PDT) In-Reply-To: <1286302827-31043-1-git-send-email-dmonakhov@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Currently dq_list_lock is responsible for quota format protection which is counter productive. Introduce didicated lock. Signed-off-by: Dmitry Monakhov --- 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 = "a_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