aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-04-19 13:38:14 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-04-19 13:38:14 -0400
commiteb9cc7e16b32c898a1d715733c590f115aa0a099 (patch)
tree0a8343dc815ce3480c2dbed7707126e15113de5d /fs/ext4/namei.c
parentfd03d8daf417fffbcb27fdb30d60f6c81ed813c8 (diff)
ext4: move quota initialization out of inode allocation transaction
Inode allocation transaction is pretty heavy (246 credits with quotas and extents before previous patch, still around 200 after it). This is mostly due to credits required for allocation of quota structures (credits there are heavily overestimated but it's difficult to make better estimates if we don't want to wire non-trivial assumptions about quota format into filesystem). So move quota initialization out of allocation transaction. That way transaction for quota structure allocation will be started only if we need to look up quota structure on disk (rare) and furthermore it will be started for each quota type separately, not for all of them at once. This reduces maximum transaction size to 34 is most cases and to 73 in the worst case. [ Modified by tytso to clean up the cleanup paths for error handling. Also use a separate call to ext4_std_error() for each failure so it is easier for someone who is debugging a problem in this function to determine which function call failed. ] Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 45a5ca89797f..955c907fc980 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2252,8 +2252,7 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode,
2252 dquot_initialize(dir); 2252 dquot_initialize(dir);
2253 2253
2254 credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 2254 credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
2255 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + 2255 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
2256 EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
2257retry: 2256retry:
2258 inode = ext4_new_inode_start_handle(dir, mode, &dentry->d_name, 0, 2257 inode = ext4_new_inode_start_handle(dir, mode, &dentry->d_name, 0,
2259 NULL, EXT4_HT_DIR, credits); 2258 NULL, EXT4_HT_DIR, credits);
@@ -2287,8 +2286,7 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry,
2287 dquot_initialize(dir); 2286 dquot_initialize(dir);
2288 2287
2289 credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 2288 credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
2290 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + 2289 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
2291 EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
2292retry: 2290retry:
2293 inode = ext4_new_inode_start_handle(dir, mode, &dentry->d_name, 0, 2291 inode = ext4_new_inode_start_handle(dir, mode, &dentry->d_name, 0,
2294 NULL, EXT4_HT_DIR, credits); 2292 NULL, EXT4_HT_DIR, credits);
@@ -2397,8 +2395,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
2397 dquot_initialize(dir); 2395 dquot_initialize(dir);
2398 2396
2399 credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 2397 credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
2400 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + 2398 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
2401 EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
2402retry: 2399retry:
2403 inode = ext4_new_inode_start_handle(dir, S_IFDIR | mode, 2400 inode = ext4_new_inode_start_handle(dir, S_IFDIR | mode,
2404 &dentry->d_name, 2401 &dentry->d_name,
@@ -2827,8 +2824,7 @@ static int ext4_symlink(struct inode *dir,
2827 * quota blocks, sb is already counted in previous macros). 2824 * quota blocks, sb is already counted in previous macros).
2828 */ 2825 */
2829 credits = EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 2826 credits = EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
2830 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + 2827 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3;
2831 EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb);
2832 } 2828 }
2833retry: 2829retry:
2834 inode = ext4_new_inode_start_handle(dir, S_IFLNK|S_IRWXUGO, 2830 inode = ext4_new_inode_start_handle(dir, S_IFLNK|S_IRWXUGO,