diff options
author | Theodore Ts'o <tytso@mit.edu> | 2010-06-11 23:14:04 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-06-11 23:14:04 -0400 |
commit | a0375156ca1041574b5d47cc7e32f10b891151b0 (patch) | |
tree | b791961012b9348f289c3dda5dc071bdf9b736d2 /fs/ext4/resize.c | |
parent | 7e27d6e778cd87b6f2415515d7127eba53fe5d02 (diff) |
ext4: Clean up s_dirt handling
We don't need to set s_dirt in most of the ext4 code when journaling
is enabled. In ext3/4 some of the summary statistics for # of free
inodes, blocks, and directories are calculated from the per-block
group statistics when the file system is mounted or unmounted. As a
result the superblock doesn't have to be updated, either via the
journal or by setting s_dirt. There are a few exceptions, most
notably when resizing the file system, where the superblock needs to
be modified --- and in that case it should be done as a journalled
operation if possible, and s_dirt set only in no-journal mode.
This patch will optimize out some unneeded disk writes when using ext4
with a journal.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/resize.c')
-rw-r--r-- | fs/ext4/resize.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 6df797eb9aeb..27527ae466ea 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -921,8 +921,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) | |||
921 | &sbi->s_flex_groups[flex_group].free_inodes); | 921 | &sbi->s_flex_groups[flex_group].free_inodes); |
922 | } | 922 | } |
923 | 923 | ||
924 | ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh); | 924 | ext4_handle_dirty_super(handle, sb); |
925 | sb->s_dirt = 1; | ||
926 | 925 | ||
927 | exit_journal: | 926 | exit_journal: |
928 | mutex_unlock(&sbi->s_resize_lock); | 927 | mutex_unlock(&sbi->s_resize_lock); |
@@ -1045,13 +1044,12 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1045 | goto exit_put; | 1044 | goto exit_put; |
1046 | } | 1045 | } |
1047 | ext4_blocks_count_set(es, o_blocks_count + add); | 1046 | ext4_blocks_count_set(es, o_blocks_count + add); |
1048 | ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh); | ||
1049 | sb->s_dirt = 1; | ||
1050 | mutex_unlock(&EXT4_SB(sb)->s_resize_lock); | 1047 | mutex_unlock(&EXT4_SB(sb)->s_resize_lock); |
1051 | ext4_debug("freeing blocks %llu through %llu\n", o_blocks_count, | 1048 | ext4_debug("freeing blocks %llu through %llu\n", o_blocks_count, |
1052 | o_blocks_count + add); | 1049 | o_blocks_count + add); |
1053 | /* We add the blocks to the bitmap and set the group need init bit */ | 1050 | /* We add the blocks to the bitmap and set the group need init bit */ |
1054 | ext4_add_groupblocks(handle, sb, o_blocks_count, add); | 1051 | ext4_add_groupblocks(handle, sb, o_blocks_count, add); |
1052 | ext4_handle_dirty_super(handle, sb); | ||
1055 | ext4_debug("freed blocks %llu through %llu\n", o_blocks_count, | 1053 | ext4_debug("freed blocks %llu through %llu\n", o_blocks_count, |
1056 | o_blocks_count + add); | 1054 | o_blocks_count + add); |
1057 | if ((err = ext4_journal_stop(handle))) | 1055 | if ((err = ext4_journal_stop(handle))) |