From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-fsdevel@vger.kernel.org
Cc: jack@suse.cz, hch@infradead.org,
Dmitry Monakhov <dmonakhov@gmail.com>,
Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 09/19] quota: rename dq_lock
Date: Fri, 22 Oct 2010 21:34:54 +0400 [thread overview]
Message-ID: <1287768904-27810-10-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1287768904-27810-1-git-send-email-dmonakhov@openvz.org>
From: Dmitry Monakhov <dmonakhov@gmail.com>
Give dquot mutex more appropriate name.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ocfs2/quota_global.c | 14 +++++++-------
fs/quota/dquot.c | 26 +++++++++++++-------------
fs/quota/quota_tree.c | 2 +-
include/linux/quota.h | 2 +-
4 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index cdae8d1..b464947 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -32,7 +32,7 @@
* Locking of quotas with OCFS2 is rather complex. Here are rules that
* should be obeyed by all the functions:
* - any write of quota structure (either to local or global file) is protected
- * by dqio_mutex or dquot->dq_lock.
+ * by dqio_mutex or dquot->dq_mutex.
* - any modification of global quota file holds inode cluster lock, i_mutex,
* and ip_alloc_sem of the global quota file (achieved by
* ocfs2_lock_global_qf). It also has to hold qinfo_lock.
@@ -47,13 +47,13 @@
* write to gf
* -> write to lf
* Acquire dquot for the first time:
- * dq_lock -> ocfs2_lock_global_qf -> qinfo_lock -> read from gf
+ * dq_mutex -> ocfs2_lock_global_qf -> qinfo_lock -> read from gf
* -> alloc space for gf
* -> start_trans -> qinfo_lock -> write to gf
* -> ip_alloc_sem of lf -> alloc space for lf
* -> write to lf
* Release last reference to dquot:
- * dq_lock -> ocfs2_lock_global_qf -> start_trans -> qinfo_lock -> write to gf
+ * dq_mutex -> ocfs2_lock_global_qf -> start_trans -> qinfo_lock -> write to gf
* -> write to lf
* Note that all the above operations also hold the inode cluster lock of lf.
* Recovery:
@@ -690,7 +690,7 @@ static int ocfs2_release_dquot(struct dquot *dquot)
mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type);
- mutex_lock(&dquot->dq_lock);
+ mutex_lock(&dquot->dq_mutex);
/* Check whether we are not racing with some other dqget() */
if (atomic_read(&dquot->dq_count) > 1)
goto out;
@@ -723,7 +723,7 @@ out_trans:
out_ilock:
ocfs2_unlock_global_qf(oinfo, 1);
out:
- mutex_unlock(&dquot->dq_lock);
+ mutex_unlock(&dquot->dq_mutex);
mlog_exit(status);
return status;
}
@@ -746,7 +746,7 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
handle_t *handle;
mlog_entry("id=%u, type=%d", dquot->dq_id, type);
- mutex_lock(&dquot->dq_lock);
+ mutex_lock(&dquot->dq_mutex);
/*
* We need an exclusive lock, because we're going to update use count
* and instantiate possibly new dquot structure
@@ -810,7 +810,7 @@ out_dq:
goto out;
set_bit(DQ_ACTIVE_B, &dquot->dq_flags);
out:
- mutex_unlock(&dquot->dq_lock);
+ mutex_unlock(&dquot->dq_mutex);
mlog_exit(status);
return status;
}
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 2d08996..fdaa386 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -106,17 +106,17 @@
* sure they cannot race with quotaon which first sets S_NOQUOTA flag and
* then drops all pointers to dquots from an inode.
*
- * Each dquot has its dq_lock mutex. Locked dquots might not be referenced
- * from inodes (dquot_alloc_space() and such don't check the dq_lock).
+ * Each dquot has its dq_mutex mutex. Locked dquots might not be referenced
+ * from inodes (dquot_alloc_space() and such don't check the dq_mutex).
* Currently dquot is locked only when it is being read to memory (or space for
* it is being allocated) on the first dqget() and when it is being released on
* the last dqput(). The allocation and release oparations are serialized by
- * the dq_lock and by checking the use count in dquot_release(). Write
- * operations on dquots don't hold dq_lock as they copy data under dq_data_lock
+ * the dq_mutex and by checking the use count in dquot_release(). Write
+ * operations on dquots don't hold dq_mutex as they copy data under dq_data_lock
* spinlock to internal buffers before writing.
*
* Lock ordering (including related VFS locks) is the following:
- * i_mutex > dqonoff_sem > journal_lock > dqptr_sem > dquot->dq_lock >
+ * i_mutex > dqonoff_sem > journal_lock > dqptr_sem > dquot->dq_mutex >
* dqio_mutex
* The lock ordering of dqptr_sem imposed by quota code is only dqonoff_sem >
* dqptr_sem. But filesystem has to count with the fact that functions such as
@@ -321,8 +321,8 @@ static inline void remove_inuse(struct dquot *dquot)
static void wait_on_dquot(struct dquot *dquot)
{
- mutex_lock(&dquot->dq_lock);
- mutex_unlock(&dquot->dq_lock);
+ mutex_lock(&dquot->dq_mutex);
+ mutex_unlock(&dquot->dq_mutex);
}
static inline int dquot_dirty(struct dquot *dquot)
@@ -404,7 +404,7 @@ int dquot_acquire(struct dquot *dquot)
int ret = 0, ret2 = 0;
struct quota_info *dqopt = sb_dqopts(dquot);
- mutex_lock(&dquot->dq_lock);
+ mutex_lock(&dquot->dq_mutex);
mutex_lock(&dqopt->dqio_mutex);
if (!test_bit(DQ_READ_B, &dquot->dq_flags))
ret = dqopt->fmt_ops[dquot->dq_type]->read_dqblk(dquot);
@@ -429,7 +429,7 @@ int dquot_acquire(struct dquot *dquot)
set_bit(DQ_ACTIVE_B, &dquot->dq_flags);
out_iolock:
mutex_unlock(&dqopt->dqio_mutex);
- mutex_unlock(&dquot->dq_lock);
+ mutex_unlock(&dquot->dq_mutex);
return ret;
}
EXPORT_SYMBOL(dquot_acquire);
@@ -474,7 +474,7 @@ int dquot_release(struct dquot *dquot)
int ret = 0, ret2 = 0;
struct quota_info *dqopt = sb_dqopts(dquot);
- mutex_lock(&dquot->dq_lock);
+ mutex_lock(&dquot->dq_mutex);
/* Check whether we are not racing with some other dqget() */
if (atomic_read(&dquot->dq_count) > 1)
goto out_dqlock;
@@ -492,7 +492,7 @@ int dquot_release(struct dquot *dquot)
clear_bit(DQ_ACTIVE_B, &dquot->dq_flags);
mutex_unlock(&dqopt->dqio_mutex);
out_dqlock:
- mutex_unlock(&dquot->dq_lock);
+ mutex_unlock(&dquot->dq_mutex);
return ret;
}
EXPORT_SYMBOL(dquot_release);
@@ -808,7 +808,7 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
if(!dquot)
return NULL;
- mutex_init(&dquot->dq_lock);
+ mutex_init(&dquot->dq_mutex);
INIT_LIST_HEAD(&dquot->dq_free);
INIT_LIST_HEAD(&dquot->dq_inuse);
INIT_HLIST_NODE(&dquot->dq_hash);
@@ -872,7 +872,7 @@ we_slept:
dqstats_inc(DQST_CACHE_HITS);
dqstats_inc(DQST_LOOKUPS);
}
- /* Wait for dq_lock - after this we know that either dquot_release() is
+ /* Wait for dq_mutex - after this we know that either dquot_release() is
* already finished or it will be canceled due to dq_count > 1 test */
wait_on_dquot(dquot);
/* Read the dquot / allocate space in quota file */
diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c
index c0917f4..21a4a6a 100644
--- a/fs/quota/quota_tree.c
+++ b/fs/quota/quota_tree.c
@@ -647,7 +647,7 @@ out:
EXPORT_SYMBOL(qtree_read_dquot);
/* Check whether dquot should not be deleted. We know we are
- * the only one operating on dquot (thanks to dq_lock) */
+ * the only one operating on dquot (thanks to dq_mutex) */
int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
{
if (test_bit(DQ_FAKE_B, &dquot->dq_flags) &&
diff --git a/include/linux/quota.h b/include/linux/quota.h
index eaa9f91..754aedb 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -287,7 +287,7 @@ struct dquot {
struct list_head dq_inuse; /* List of all quotas */
struct list_head dq_free; /* Free list element */
struct list_head dq_dirty; /* List of dirty dquots */
- struct mutex dq_lock; /* dquot IO lock */
+ struct mutex dq_mutex; /* dquot IO mutex */
atomic_t dq_count; /* Use count */
wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */
struct super_block *dq_sb; /* superblock this applies to */
--
1.6.5.2
next prev parent reply other threads:[~2010-10-22 17:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-22 17:34 [PATCH 00/19] quota: RFC SMP improvements for generic quota V2 Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 01/19] quota: protect getfmt call with dqonoff_mutex lock Dmitry Monakhov
2010-10-28 14:27 ` Christoph Hellwig
2010-10-22 17:34 ` [PATCH 02/19] quota: Wrap common expression to helper function Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 03/19] quota: mode quota internals from sb to quota_info Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 04/19] quota: Convert dq_state_lock to per-sb dq_state_lock Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 05/19] quota: add quota format lock Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 06/19] quota: make dquot lists per-sb Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 07/19] quota: make per-sb hash array Dmitry Monakhov
2010-10-27 19:31 ` Al Viro
2010-10-28 10:58 ` Dmitry
2010-10-22 17:34 ` [PATCH 08/19] quota: remove global dq_list_lock Dmitry Monakhov
2010-10-22 17:34 ` Dmitry Monakhov [this message]
2010-10-22 17:34 ` [PATCH 10/19] quota: make per-sb dq_data_lock Dmitry Monakhov
2010-10-26 17:38 ` Dmitry
2010-10-22 17:34 ` [PATCH 11/19] quota: protect dquot mem info with object's lock Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 12/19] quota: drop dq_data_lock where possible Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 13/19] quota: relax dq_data_lock dq_lock locking consistency Dmitry Monakhov
2010-10-22 17:34 ` [PATCH 14/19] quota: protect dqget() from parallels quotaoff via RCU Dmitry Monakhov
2010-10-22 17:35 ` [PATCH 15/19] quota: remove dq_state_lock Dmitry Monakhov
2010-10-22 17:35 ` [PATCH 16/19] fs: add unlocked helpers Dmitry Monakhov
2010-10-22 17:35 ` [PATCH 17/19] quota: Some stylistic cleanup for dquot interface Dmitry Monakhov
2010-10-22 17:35 ` [PATCH 18/19] quota: remove dqptr_sem Dmitry Monakhov
2010-10-22 17:35 ` [PATCH 19/19] quota: redesign dquot reference counting Dmitry Monakhov
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=1287768904-27810-10-git-send-email-dmonakhov@openvz.org \
--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).