1 commit 1ea06bec78a128adc995ca32bd906a6c9bb9cf91
2 Author: Niu Yawei <yawei.niu@gmail.com>
3 Date: Wed Jun 4 12:20:30 2014 +0800
5 quota: avoid unnecessary dqget()/dqput() calls
7 Avoid unnecessary dqget()/dqput() calls in __dquot_initialize(),
8 that will introduce global lock contention otherwise.
10 Signed-off-by: Lai Siyao <lai.siyao@intel.com>
11 Signed-off-by: Niu Yawei <yawei.niu@intel.com>
12 Signed-off-by: Jan Kara <jack@suse.cz>
13 Index: linux-3.0.101-0.46_lustre.gbe21584/fs/quota/dquot.c
14 ===================================================================
15 --- linux-3.0.101-0.46_lustre.gbe21584.orig/fs/quota/dquot.c
16 +++ linux-3.0.101-0.46_lustre.gbe21584/fs/quota/dquot.c
17 @@ -1342,7 +1342,7 @@ static int dquot_active(const struct ino
18 static void __dquot_initialize(struct inode *inode, int type)
22 + int cnt, init_needed = 0;
23 struct dquot *got[MAXQUOTAS];
24 struct super_block *sb = inode->i_sb;
26 @@ -1357,6 +1357,15 @@ static void __dquot_initialize(struct in
28 if (type != -1 && cnt != type)
31 + * The i_dquot should have been initialized in most cases,
32 + * we check it without locking here to avoid unnecessary
33 + * dqget()/dqput() calls.
35 + if (inode->i_dquot[cnt])
42 @@ -1368,6 +1377,10 @@ static void __dquot_initialize(struct in
43 got[cnt] = dqget(sb, id, cnt);
46 + /* All required i_dquot has been initialized */
50 spin_lock(&inode->i_lock);
51 if (IS_NOQUOTA(inode))