[PATCH 15/19] quota: drop dq_data_lock where possible

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

 



dq_data_lock is no longer responsible for dquot data protection.

Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
---
 fs/ocfs2/quota_global.c |    4 ----
 fs/ocfs2/quota_local.c  |    4 ----
 fs/quota/dquot.c        |    5 +----
 fs/quota/quota_tree.c   |    4 ----
 4 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index c005693..3d2841c 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -503,7 +503,6 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
 	/* Update space and inode usage. Get also other information from
 	 * global quota file so that we don't overwrite any changes there.
 	 * We are */
-	spin_lock(&dqopts(sb)->dq_data_lock);
 	spin_lock(&dquot->dq_lock);
 	spacechange = dquot->dq_dqb.dqb_curspace -
 					OCFS2_DQUOT(dquot)->dq_origspace;
@@ -559,7 +558,6 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
 	OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace;
 	OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes;
 	spin_unlock(&dquot->dq_lock);
-	spin_unlock(&dqopts(sb)->dq_data_lock);
 	err = ocfs2_qinfo_lock(info, freeing);
 	if (err < 0) {
 		mlog(ML_ERROR, "Failed to lock quota info, loosing quota write"
@@ -838,12 +836,10 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
 
 	/* In case user set some limits, sync dquot immediately to global
 	 * quota file so that information propagates quicker */
-	spin_lock(&dqopts(sb)->dq_data_lock);
 	spin_lock(&dquot->dq_lock);
 	if (dquot->dq_flags & mask)
 		sync = 1;
 	spin_unlock(&dquot->dq_lock);
-	spin_unlock(&dqopts(sb)->dq_data_lock);
 	/* This is a slight hack but we can't afford getting global quota
 	 * lock if we already have a transaction started. */
 	if (!sync || journal_current_handle()) {
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 1490cb0..9e68ce5 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -524,7 +524,6 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
 				goto out_drop_lock;
 			}
 			mutex_lock(&dqopts(sb)->dqio_mutex);
-			spin_lock(&dqopts(sb)->dq_data_lock);
 			spin_lock(&dquot->dq_lock);
 			/* Add usage from quota entry into quota changes
 			 * of our node. Auxiliary variables are important
@@ -534,7 +533,6 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
 			dquot->dq_dqb.dqb_curspace += spacechange;
 			dquot->dq_dqb.dqb_curinodes += inodechange;
 			spin_unlock(&dquot->dq_lock);
-			spin_unlock(&dqopts(sb)->dq_data_lock);
 			/* We want to drop reference held by the crashed
 			 * node. Since we have our own reference we know
 			 * global structure actually won't be freed. */
@@ -879,14 +877,12 @@ static void olq_set_dquot(struct buffer_head *bh, void *private)
 		+ ol_dqblk_block_offset(sb, od->dq_local_off));
 
 	dqblk->dqb_id = cpu_to_le64(od->dq_dquot.dq_id);
-	spin_lock(&dqopts(sb)->dq_data_lock);
 	spin_lock(&od->dq_dquot.dq_lock);
 	dqblk->dqb_spacemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curspace -
 					  od->dq_origspace);
 	dqblk->dqb_inodemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curinodes -
 					  od->dq_originodes);
 	spin_unlock(&od->dq_dquot.dq_lock);
-	spin_unlock(&dqopts(sb)->dq_data_lock);
 	mlog(0, "Writing local dquot %u space %lld inodes %lld\n",
 	     od->dq_dquot.dq_id, (long long)le64_to_cpu(dqblk->dqb_spacemod),
 	     (long long)le64_to_cpu(dqblk->dqb_inodemod));
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 5898b46..794c486 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1468,7 +1468,7 @@ static void __dquot_initialize(struct inode *inode, int type)
 	down_write(&dqopts(sb)->dqptr_sem);
 	if (IS_NOQUOTA(inode))
 		goto out_err;
-	spin_lock(&dqopts(sb)->dq_data_lock);
+
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		if (type != -1 && cnt != type)
 			continue;
@@ -1493,7 +1493,6 @@ static void __dquot_initialize(struct inode *inode, int type)
 			}
 		}
 	}
-	spin_unlock(&dqopts(sb)->dq_data_lock);
 out_err:
 	up_write(&dqopts(sb)->dqptr_sem);
 	srcu_read_unlock(&dqopts(sb)->dq_srcu, idx);
@@ -2545,7 +2544,6 @@ static void do_get_dqblk(struct dquot *dquot, struct fs_disk_quota *di)
 			FS_USER_QUOTA : FS_GROUP_QUOTA;
 	di->d_id = dquot->dq_id;
 
-	spin_lock(&sb_dqopts(dquot)->dq_data_lock);
 	spin_lock(&dquot->dq_lock);
 	di->d_blk_hardlimit = stoqb(dm->dqb_bhardlimit);
 	di->d_blk_softlimit = stoqb(dm->dqb_bsoftlimit);
@@ -2556,7 +2554,6 @@ static void do_get_dqblk(struct dquot *dquot, struct fs_disk_quota *di)
 	di->d_btimer = dm->dqb_btime;
 	di->d_itimer = dm->dqb_itime;
 	spin_unlock(&dquot->dq_lock);
-	spin_unlock(&sb_dqopts(dquot)->dq_data_lock);
 }
 
 int dquot_get_dqblk(struct super_block *sb, int type, qid_t id,
diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c
index e6307f6..3af6d89 100644
--- a/fs/quota/quota_tree.c
+++ b/fs/quota/quota_tree.c
@@ -375,11 +375,9 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
 			return ret;
 		}
 	}
-	spin_lock(&dqopts(sb)->dq_data_lock);
 	spin_lock(&dquot->dq_lock);
 	info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
 	spin_unlock(&dquot->dq_lock);
-	spin_unlock(&dqopts(sb)->dq_data_lock);
 	ret = sb->s_op->quota_write(sb, type, ddquot, info->dqi_entry_size,
 				    dquot->dq_off);
 	if (ret != info->dqi_entry_size) {
@@ -633,7 +631,6 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
 		kfree(ddquot);
 		goto out;
 	}
-	spin_lock(&dqopts(sb)->dq_data_lock);
 	spin_lock(&dquot->dq_lock);
 	info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
 	if (!dquot->dq_dqb.dqb_bhardlimit &&
@@ -642,7 +639,6 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
 	    !dquot->dq_dqb.dqb_isoftlimit)
 		set_bit(DQ_FAKE_B, &dquot->dq_flags);
 	spin_unlock(&dquot->dq_lock);
-	spin_unlock(&dqopts(sb)->dq_data_lock);
 	kfree(ddquot);
 out:
 	dqstats_inc(DQST_READS);
-- 
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