summaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-08-07 07:19:50 -0400
committerJan Kara <jack@suse.cz>2017-08-17 16:07:59 -0400
commit7b9ca4c61bc278b771fb57d6290a31ab1fc7fdac (patch)
tree3e9c7464525efa2a9dd50d02e7fe8f7df45a4961 /fs/ext4/super.c
parentf4a8116a4c8c8f754d0ec1498a2ba4b63d114e6a (diff)
quota: Reduce contention on dq_data_lock
dq_data_lock is currently used to protect all modifications of quota accounting information, consistency of quota accounting on the inode, and dquot pointers from inode. As a result contention on the lock can be pretty heavy. Reduce the contention on the lock by protecting quota accounting information by a new dquot->dq_dqb_lock and consistency of quota accounting with inode usage by inode->i_lock. This change reduces time to create 500000 files on ext4 on ramdisk by 50 different processes in separate directories by 6% when user quota is turned on. When those 50 processes belong to 50 different users, the improvement is about 9%. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 16a877a0f309..67ce21224dab 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5194,7 +5194,7 @@ static int ext4_statfs_project(struct super_block *sb,
5194 dquot = dqget(sb, qid); 5194 dquot = dqget(sb, qid);
5195 if (IS_ERR(dquot)) 5195 if (IS_ERR(dquot))
5196 return PTR_ERR(dquot); 5196 return PTR_ERR(dquot);
5197 spin_lock(&dq_data_lock); 5197 spin_lock(&dquot->dq_dqb_lock);
5198 5198
5199 limit = (dquot->dq_dqb.dqb_bsoftlimit ? 5199 limit = (dquot->dq_dqb.dqb_bsoftlimit ?
5200 dquot->dq_dqb.dqb_bsoftlimit : 5200 dquot->dq_dqb.dqb_bsoftlimit :
@@ -5217,7 +5217,7 @@ static int ext4_statfs_project(struct super_block *sb,
5217 (buf->f_files - dquot->dq_dqb.dqb_curinodes) : 0; 5217 (buf->f_files - dquot->dq_dqb.dqb_curinodes) : 0;
5218 } 5218 }
5219 5219
5220 spin_unlock(&dq_data_lock); 5220 spin_unlock(&dquot->dq_dqb_lock);
5221 dqput(dquot); 5221 dqput(dquot);
5222 return 0; 5222 return 0;
5223} 5223}