aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorYongqiang Yang <xiaoqiangnk@gmail.com>2012-09-05 01:27:50 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-13 05:38:48 +0900
commit2de1ece4de710668bb53eff74bffe80bb267087f (patch)
tree6be4c45d8a38366f6d4fdfc201b1efbbf839c62b /fs
parent1079d76f47379886ebfd3ae0f79a9f6cd62df29e (diff)
ext4: avoid duplicate writes of the backup bg descriptor blocks
commit 2ebd1704ded88a8ae29b5f3998b13959c715c4be upstream. The resize code was needlessly writing the backup block group descriptor blocks multiple times (once per block group) during an online resize. Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/resize.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 257d2f00311..231cacb8f64 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1302,13 +1302,15 @@ exit_journal:
err = err2;
if (!err) {
- int i;
+ int gdb_num = group / EXT4_DESC_PER_BLOCK(sb);
+ int gdb_num_end = ((group + flex_gd->count - 1) /
+ EXT4_DESC_PER_BLOCK(sb));
+
update_backups(sb, sbi->s_sbh->b_blocknr, (char *)es,
sizeof(struct ext4_super_block));
- for (i = 0; i < flex_gd->count; i++, group++) {
+ for (; gdb_num <= gdb_num_end; gdb_num++) {
struct buffer_head *gdb_bh;
- int gdb_num;
- gdb_num = group / EXT4_BLOCKS_PER_GROUP(sb);
+
gdb_bh = sbi->s_group_desc[gdb_num];
update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data,
gdb_bh->b_size);