Blame SOURCES/e2fsprogs-1.43.6-libext2fs-skip-start_blk-adjustment-when-stride-and-.patch

89a7ba
From 086d0f865d08ec8f723ef6a7feeb8ec8d9f3e9b5 Mon Sep 17 00:00:00 2001
89a7ba
From: Lukas Czerner <lczerner@redhat.com>
89a7ba
Date: Sat, 14 Oct 2017 10:42:30 -0400
89a7ba
Subject: [PATCH] libext2fs: skip start_blk adjustment when stride and flex_bg
89a7ba
 is set
89a7ba
89a7ba
Currently some stride optimization is done in
89a7ba
ext2fs_allocate_group_table() by adjusting start_blk block where we
89a7ba
start allocating block, or inode bitmaps.
89a7ba
89a7ba
However in flex_bg case this is currently useless since the values are
89a7ba
going to be overridden anyway. Moreover in flex_bg case the group might
89a7ba
already be full and the stride optimization will fail. As a result file
89a7ba
system resize might fail needlessly in some situations.
89a7ba
89a7ba
It can be shown by this example:
89a7ba
89a7ba
mke2fs -b 1024 -i 1024 -E stride=8192 -t ext4 /dev/loop0 1024000
89a7ba
resize2fs /dev/loop0 102400000
89a7ba
resize2fs 1.43.5 (04-Aug-2017)
89a7ba
Resizing the filesystem on /dev/loop0 to 102400000 (1k) blocks.
89a7ba
./resize/resize2fs: Could not allocate block in ext2 filesystem while trying to resize /dev/loop0
89a7ba
Please run 'e2fsck -fy /dev/loop0' to fix the filesystem
89a7ba
after the aborted resize operation.
89a7ba
89a7ba
Fix this by not doing the stride adjustment in case of flex_bg.
89a7ba
89a7ba
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
89a7ba
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
89a7ba
---
89a7ba
 lib/ext2fs/alloc_tables.c | 2 +-
89a7ba
 1 file changed, 1 insertion(+), 1 deletion(-)
89a7ba
89a7ba
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
89a7ba
index 9f3d4e0..dd6015e 100644
89a7ba
--- a/lib/ext2fs/alloc_tables.c
89a7ba
+++ b/lib/ext2fs/alloc_tables.c
89a7ba
@@ -108,7 +108,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
89a7ba
 	/*
89a7ba
 	 * Allocate the block and inode bitmaps, if necessary
89a7ba
 	 */
89a7ba
-	if (fs->stride) {
89a7ba
+	if (fs->stride && !flexbg_size) {
89a7ba
 		retval = ext2fs_get_free_blocks2(fs, group_blk, last_blk,
89a7ba
 						 1, bmap, &start_blk);
89a7ba
 		if (retval)
89a7ba
-- 
89a7ba
2.7.5
89a7ba