From b333384188e235df668130538a307e088c872138 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Thu, 10 Sep 2009 21:51:50 +0000 Subject: [PATCH] - fixing resize -m bug (#519131) --- e2fsprogs-resize-minimum-fix.patch | 51 ++++++++++++++++++++++++++++++ e2fsprogs.spec | 7 +++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 e2fsprogs-resize-minimum-fix.patch diff --git a/e2fsprogs-resize-minimum-fix.patch b/e2fsprogs-resize-minimum-fix.patch new file mode 100644 index 0000000..179ebfe --- /dev/null +++ b/e2fsprogs-resize-minimum-fix.patch @@ -0,0 +1,51 @@ +--- + resize/resize2fs.c | 20 +++++++++++++++++--- + 1 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/resize/resize2fs.c b/resize/resize2fs.c +index c0b00b6..648e1f9 100644 +--- a/resize/resize2fs.c ++++ b/resize/resize2fs.c +@@ -1900,6 +1900,8 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs) + blk_t inode_count, blks_needed, groups, data_blocks; + blk_t grp, data_needed, last_start; + int overhead = 0, num_of_superblocks = 0; ++ int extra_groups = 0; ++ int flexbg_size = 1 << fs->super->s_log_groups_per_flex; + + /* + * first figure out how many group descriptors we need to +@@ -1934,11 +1936,9 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs) + * of inode tables of slack space so the resize + * operation can be guaranteed to finish. + */ +- int flexbg_size = 1 << fs->super->s_log_groups_per_flex; +- int extra_groups; +- + extra_groups = flexbg_size - (groups & (flexbg_size - 1)); + data_needed += META_OVERHEAD(fs) * extra_groups; ++ extra_groups = groups % flexbg_size; + } + + /* +@@ -2002,6 +2002,20 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs) + } + + groups += extra_grps; ++ extra_groups += extra_grps; ++ if (fs->super->s_feature_incompat ++ & EXT4_FEATURE_INCOMPAT_FLEX_BG ++ && extra_groups > flexbg_size) { ++ /* ++ * For ext4 we need to allow for up to a flex_bg worth ++ * of inode tables of slack space so the resize ++ * operation can be guaranteed to finish. ++ */ ++ extra_groups = flexbg_size - ++ (groups & (flexbg_size - 1)); ++ data_needed += META_OVERHEAD(fs) * extra_groups; ++ extra_groups = groups % flexbg_size; ++ } + } + + /* now for the fun voodoo */ diff --git a/e2fsprogs.spec b/e2fsprogs.spec index 5fca4a8..60701ff 100644 --- a/e2fsprogs.spec +++ b/e2fsprogs.spec @@ -4,7 +4,7 @@ Summary: Utilities for managing ext2, ext3, and ext4 filesystems Name: e2fsprogs Version: 1.41.9 -Release: 1%{?dist} +Release: 2%{?dist} # License tags based on COPYING file distinctions for various components License: GPLv2 @@ -14,6 +14,7 @@ Source1: ext2_types-wrapper.h Patch2: e2fsprogs-1.40.4-sb_feature_check_ignore.patch Patch3: e2fsprogs-1.41.9-defrag.patch +Patch4: e2fsprogs-resize-minimum-fix.patch Url: http://e2fsprogs.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -141,6 +142,7 @@ It was originally inspired by the Multics SubSystem library. %patch2 -p1 -b .featurecheck # defrag command for testing, from non-release branch %patch3 -p1 -b .defrag +%patch4 -p1 -b .resize %build %configure --enable-elf-shlibs --enable-nls --disable-uuidd --disable-fsck \ @@ -301,6 +303,9 @@ exit 0 %{_libdir}/pkgconfig/ss.pc %changelog +* Thu Sep 10 2009 Josef Bacik 1.41.9-2 +- Fix resize -m bug with flexbg (#519131) + * Sun Aug 23 2009 Eric Sandeen 1.41.9-1 - New upstream release