Commit 70d4c9f2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext2_new_inode nanocleanup

We've cached EXT2_SB(sb) in local variable `sbi'.  Use it.
parent 0fd0c48e
...@@ -507,7 +507,7 @@ struct inode *ext2_new_inode(struct inode *dir, int mode) ...@@ -507,7 +507,7 @@ struct inode *ext2_new_inode(struct inode *dir, int mode)
group = 0; group = 0;
continue; continue;
} }
if (ext2_set_bit_atomic(sb_bgl_lock(EXT2_SB(sb), group), if (ext2_set_bit_atomic(sb_bgl_lock(sbi, group),
ino, bitmap_bh->b_data)) { ino, bitmap_bh->b_data)) {
/* we lost this inode */ /* we lost this inode */
if (++ino >= EXT2_INODES_PER_GROUP(sb)) { if (++ino >= EXT2_INODES_PER_GROUP(sb)) {
...@@ -543,23 +543,23 @@ struct inode *ext2_new_inode(struct inode *dir, int mode) ...@@ -543,23 +543,23 @@ struct inode *ext2_new_inode(struct inode *dir, int mode)
goto fail; goto fail;
} }
percpu_counter_mod(&EXT2_SB(sb)->s_freeinodes_counter, -1); percpu_counter_mod(&sbi->s_freeinodes_counter, -1);
if (S_ISDIR(mode)) if (S_ISDIR(mode))
percpu_counter_inc(&EXT2_SB(sb)->s_dirs_counter); percpu_counter_inc(&sbi->s_dirs_counter);
spin_lock(sb_bgl_lock(EXT2_SB(sb), group)); spin_lock(sb_bgl_lock(sbi, group));
gdp->bg_free_inodes_count = gdp->bg_free_inodes_count =
cpu_to_le16(le16_to_cpu(gdp->bg_free_inodes_count) - 1); cpu_to_le16(le16_to_cpu(gdp->bg_free_inodes_count) - 1);
if (S_ISDIR(mode)) { if (S_ISDIR(mode)) {
if (EXT2_SB(sb)->s_debts[group] < 255) if (sbi->s_debts[group] < 255)
EXT2_SB(sb)->s_debts[group]++; sbi->s_debts[group]++;
gdp->bg_used_dirs_count = gdp->bg_used_dirs_count =
cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1); cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1);
} else { } else {
if (EXT2_SB(sb)->s_debts[group]) if (sbi->s_debts[group])
EXT2_SB(sb)->s_debts[group]--; sbi->s_debts[group]--;
} }
spin_unlock(sb_bgl_lock(EXT2_SB(sb), group)); spin_unlock(sb_bgl_lock(sbi, group));
sb->s_dirt = 1; sb->s_dirt = 1;
mark_buffer_dirty(bh2); mark_buffer_dirty(bh2);
...@@ -599,7 +599,7 @@ struct inode *ext2_new_inode(struct inode *dir, int mode) ...@@ -599,7 +599,7 @@ struct inode *ext2_new_inode(struct inode *dir, int mode)
ei->i_dir_start_lookup = 0; ei->i_dir_start_lookup = 0;
ei->i_state = EXT2_STATE_NEW; ei->i_state = EXT2_STATE_NEW;
ext2_set_inode_flags(inode); ext2_set_inode_flags(inode);
inode->i_generation = EXT2_SB(sb)->s_next_generation++; inode->i_generation = sbi->s_next_generation++;
insert_inode_hash(inode); insert_inode_hash(inode);
if (DQUOT_ALLOC_INODE(inode)) { if (DQUOT_ALLOC_INODE(inode)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment