diff options
author | Jan Kara <jack@suse.cz> | 2017-08-07 07:19:50 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-08-17 16:07:59 -0400 |
commit | 7b9ca4c61bc278b771fb57d6290a31ab1fc7fdac (patch) | |
tree | 3e9c7464525efa2a9dd50d02e7fe8f7df45a4961 /include/linux/quota.h | |
parent | f4a8116a4c8c8f754d0ec1498a2ba4b63d114e6a (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 'include/linux/quota.h')
-rw-r--r-- | include/linux/quota.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h index eccc1cb6274e..074123975595 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -298,12 +298,13 @@ struct dquot { | |||
298 | struct list_head dq_free; /* Free list element */ | 298 | struct list_head dq_free; /* Free list element */ |
299 | struct list_head dq_dirty; /* List of dirty dquots */ | 299 | struct list_head dq_dirty; /* List of dirty dquots */ |
300 | struct mutex dq_lock; /* dquot IO lock */ | 300 | struct mutex dq_lock; /* dquot IO lock */ |
301 | spinlock_t dq_dqb_lock; /* Lock protecting dq_dqb changes */ | ||
301 | atomic_t dq_count; /* Use count */ | 302 | atomic_t dq_count; /* Use count */ |
302 | struct super_block *dq_sb; /* superblock this applies to */ | 303 | struct super_block *dq_sb; /* superblock this applies to */ |
303 | struct kqid dq_id; /* ID this applies to (uid, gid, projid) */ | 304 | struct kqid dq_id; /* ID this applies to (uid, gid, projid) */ |
304 | loff_t dq_off; /* Offset of dquot on disk */ | 305 | loff_t dq_off; /* Offset of dquot on disk */ |
305 | unsigned long dq_flags; /* See DQ_* */ | 306 | unsigned long dq_flags; /* See DQ_* */ |
306 | struct mem_dqblk dq_dqb; /* Diskquota usage */ | 307 | struct mem_dqblk dq_dqb; /* Diskquota usage [dq_dqb_lock] */ |
307 | }; | 308 | }; |
308 | 309 | ||
309 | /* Operations which must be implemented by each quota format */ | 310 | /* Operations which must be implemented by each quota format */ |