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/ext4_jbd2.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/ext4_jbd2.c')
-rw-r--r-- | fs/ext4/ext4_jbd2.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index 53d2764d71ca..cfd27b38fa15 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c | |||
@@ -143,3 +143,19 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, | |||
143 | } | 143 | } |
144 | return err; | 144 | return err; |
145 | } | 145 | } |
146 | |||
147 | int __ext4_handle_dirty_super(const char *where, handle_t *handle, | ||
148 | struct super_block *sb) | ||
149 | { | ||
150 | struct buffer_head *bh = EXT4_SB(sb)->s_sbh; | ||
151 | int err = 0; | ||
152 | |||
153 | if (ext4_handle_valid(handle)) { | ||
154 | err = jbd2_journal_dirty_metadata(handle, bh); | ||
155 | if (err) | ||
156 | ext4_journal_abort_handle(where, __func__, bh, | ||
157 | handle, err); | ||
158 | } else | ||
159 | sb->s_dirt = 1; | ||
160 | return err; | ||
161 | } | ||