[PATCH 09/19] quota: rename dq_lock

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

 



From: Dmitry Monakhov <dmonakhov@xxxxxxxxx>

Give dquot mutex more appropriate name.

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

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