From f844b32a09b29e2b122f7e7cb0302c996dbf8276 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 28 Aug 2008 13:24:12 -0400 Subject: [PATCH] resize2fs: Allow (non-optimal) on-line resizing for flex_bg filesystems The current method of adding one block group at a time to a mounted filesystem means it is impossible to accomodate the flex_bg allocation method of placing the metadata together in a single block group. For now we "fix" this issue by using the traditional layout for new block groups, where each block group is self-contained and contains its own bitmap blocks and inode tables. This means we don't get the layout advantages of flex_bg in the new block groups, but at least it allows on-line resizing to function. Long term, we will need to create a new ioctl which does much more of the resizing work in the kernel. We also fix a bug in the ext3/ext4 ioctl fallback code so we stop trying the ext3 ioctl for every single block group when resizing an ext4 filesystem. Signed-off-by: "Theodore Ts'o" --- resize/online.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/resize/online.c b/resize/online.c index f4d24ce..d581553 100644 --- a/resize/online.c +++ b/resize/online.c @@ -93,6 +93,17 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, if (retval) return retval; + /* The current method of adding one block group at a time to a + * mounted filesystem means it is impossible to accomodate the + * flex_bg allocation method of placing the metadata together + * in a single block group. For now we "fix" this issue by + * using the traditional layout for new block groups, where + * each block group is self-contained and contains its own + * bitmap blocks and inode tables. This means we don't get + * the layout advantages of flex_bg in the new block groups, + * but at least it allows on-line resizing to function. + */ + new_fs->super->s_feature_incompat &= ~EXT4_FEATURE_INCOMPAT_FLEX_BG; retval = adjust_fs_info(new_fs, fs, *new_size); if (retval) return retval; @@ -154,7 +165,7 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, ioctl(fd, EXT2_IOC_GROUP_ADD, &input) == 0) continue; else - use_old_ioctl = 1; + use_old_ioctl = 0; input64.group = input.group; input64.block_bitmap = input.block_bitmap; -- 1.8.3.1