aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2012-09-26 00:08:57 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-09-26 00:08:57 -0400
commit0acdb8876fead922c9ffa6768c5675a37485c48c (patch)
treeb4cca27cf1cff13e704e5eed85a8248a38da8ec7 /fs
parent7f1468d1d50d368097ab13596dc08eaba7eace7f (diff)
ext4: don't call update_backups() multiple times for the same bg
When performing an online resize, we add a bunch of groups at one time in ext4_flex_group_add, so in most cases a lot of group descriptors will be in the same group block. But in the end of this function, update_backups will be called for every group descriptor and the same block will be copied and journalled again and again. It is really a waste. Fix things so we only update a particular bg descriptor block once and skip subsequent updates of the same block. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/resize.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index f21fdbf5c75d..7a75e1086961 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1460,6 +1460,7 @@ exit_journal:
1460 EXT4_DESC_PER_BLOCK(sb)); 1460 EXT4_DESC_PER_BLOCK(sb));
1461 int meta_bg = EXT4_HAS_INCOMPAT_FEATURE(sb, 1461 int meta_bg = EXT4_HAS_INCOMPAT_FEATURE(sb,
1462 EXT4_FEATURE_INCOMPAT_META_BG); 1462 EXT4_FEATURE_INCOMPAT_META_BG);
1463 sector_t old_gdb = 0;
1463 1464
1464 update_backups(sb, sbi->s_sbh->b_blocknr, (char *)es, 1465 update_backups(sb, sbi->s_sbh->b_blocknr, (char *)es,
1465 sizeof(struct ext4_super_block), 0); 1466 sizeof(struct ext4_super_block), 0);
@@ -1467,8 +1468,11 @@ exit_journal:
1467 struct buffer_head *gdb_bh; 1468 struct buffer_head *gdb_bh;
1468 1469
1469 gdb_bh = sbi->s_group_desc[gdb_num]; 1470 gdb_bh = sbi->s_group_desc[gdb_num];
1471 if (old_gdb == gdb_bh->b_blocknr)
1472 continue;
1470 update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data, 1473 update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data,
1471 gdb_bh->b_size, meta_bg); 1474 gdb_bh->b_size, meta_bg);
1475 old_gdb = gdb_bh->b_blocknr;
1472 } 1476 }
1473 } 1477 }
1474exit: 1478exit: