aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2010-04-14 08:38:36 -0400
committerJan Kara <jack@suse.cz>2010-05-21 13:30:39 -0400
commitee6921ebd04cb807dfe88b10ad80f1124813c673 (patch)
treea8892d816bb76c07b5e0f0df70596ccf0bfb6f98 /fs
parent20da9baf4cf9c627aaf7b00d64ce0b2221bab9bf (diff)
ext2: Fold ext2_commit_super() into ext2_sync_super()
Both function originally did similar things except that ext2_sync_super() is returning after the call to sync_dirty_buffer(sbh). Therefore this patch adds a wait flag to tell ext2_sync_super() if it has to call sync_dirty_buffer() to wait for in-progress I/O to finish. Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/super.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 09a88bf04579..a304c544571f 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -39,7 +39,7 @@
39#include "xip.h" 39#include "xip.h"
40 40
41static void ext2_sync_super(struct super_block *sb, 41static void ext2_sync_super(struct super_block *sb,
42 struct ext2_super_block *es); 42 struct ext2_super_block *es, int wait);
43static int ext2_remount (struct super_block * sb, int * flags, char * data); 43static int ext2_remount (struct super_block * sb, int * flags, char * data);
44static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf); 44static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf);
45static int ext2_sync_fs(struct super_block *sb, int wait); 45static int ext2_sync_fs(struct super_block *sb, int wait);
@@ -54,7 +54,7 @@ void ext2_error (struct super_block * sb, const char * function,
54 if (!(sb->s_flags & MS_RDONLY)) { 54 if (!(sb->s_flags & MS_RDONLY)) {
55 sbi->s_mount_state |= EXT2_ERROR_FS; 55 sbi->s_mount_state |= EXT2_ERROR_FS;
56 es->s_state |= cpu_to_le16(EXT2_ERROR_FS); 56 es->s_state |= cpu_to_le16(EXT2_ERROR_FS);
57 ext2_sync_super(sb, es); 57 ext2_sync_super(sb, es, 1);
58 } 58 }
59 59
60 va_start(args, fmt); 60 va_start(args, fmt);
@@ -125,7 +125,7 @@ static void ext2_put_super (struct super_block * sb)
125 struct ext2_super_block *es = sbi->s_es; 125 struct ext2_super_block *es = sbi->s_es;
126 126
127 es->s_state = cpu_to_le16(sbi->s_mount_state); 127 es->s_state = cpu_to_le16(sbi->s_mount_state);
128 ext2_sync_super(sb, es); 128 ext2_sync_super(sb, es, 1);
129 } 129 }
130 db_count = sbi->s_gdb_count; 130 db_count = sbi->s_gdb_count;
131 for (i = 0; i < db_count; i++) 131 for (i = 0; i < db_count; i++)
@@ -1127,23 +1127,16 @@ static void ext2_clear_super_error(struct super_block *sb)
1127 } 1127 }
1128} 1128}
1129 1129
1130static void ext2_commit_super (struct super_block * sb, 1130static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es,
1131 struct ext2_super_block * es) 1131 int wait)
1132{
1133 ext2_clear_super_error(sb);
1134 es->s_wtime = cpu_to_le32(get_seconds());
1135 mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
1136 sb->s_dirt = 0;
1137}
1138
1139static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es)
1140{ 1132{
1141 ext2_clear_super_error(sb); 1133 ext2_clear_super_error(sb);
1142 es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); 1134 es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb));
1143 es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); 1135 es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb));
1144 es->s_wtime = cpu_to_le32(get_seconds()); 1136 es->s_wtime = cpu_to_le32(get_seconds());
1145 mark_buffer_dirty(EXT2_SB(sb)->s_sbh); 1137 mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
1146 sync_dirty_buffer(EXT2_SB(sb)->s_sbh); 1138 if (wait)
1139 sync_dirty_buffer(EXT2_SB(sb)->s_sbh);
1147 sb->s_dirt = 0; 1140 sb->s_dirt = 0;
1148} 1141}
1149 1142
@@ -1166,11 +1159,8 @@ static int ext2_sync_fs(struct super_block *sb, int wait)
1166 if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { 1159 if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) {
1167 ext2_debug("setting valid to 0\n"); 1160 ext2_debug("setting valid to 0\n");
1168 es->s_state &= cpu_to_le16(~EXT2_VALID_FS); 1161 es->s_state &= cpu_to_le16(~EXT2_VALID_FS);
1169 ext2_sync_super(sb, es);
1170 } else {
1171 ext2_commit_super(sb, es);
1172 } 1162 }
1173 sb->s_dirt = 0; 1163 ext2_sync_super(sb, es, wait);
1174 unlock_kernel(); 1164 unlock_kernel();
1175 1165
1176 return 0; 1166 return 0;
@@ -1268,7 +1258,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
1268 if (!ext2_setup_super (sb, es, 0)) 1258 if (!ext2_setup_super (sb, es, 0))
1269 sb->s_flags &= ~MS_RDONLY; 1259 sb->s_flags &= ~MS_RDONLY;
1270 } 1260 }
1271 ext2_sync_super(sb, es); 1261 ext2_sync_super(sb, es, 1);
1272 unlock_kernel(); 1262 unlock_kernel();
1273 return 0; 1263 return 0;
1274restore_opts: 1264restore_opts: