53 lines
1.8 KiB
Diff
53 lines
1.8 KiB
Diff
From 1654b25737d2a4538964b290a75e251131fbf3c0 Mon Sep 17 00:00:00 2001
|
|
From: Jan Kara <jack@suse.cz>
|
|
Date: Tue, 19 Jun 2018 10:45:16 -0400
|
|
Subject: [PATCH 04/16] libext2fs: don't create filesystems with meta_bg and
|
|
resize_inode
|
|
|
|
commit 42e77d5db53e3ec09b5dc507169d15de219799e3
|
|
|
|
ext2fs_initialize() may end up enabling meta_bg feature for filesystem
|
|
which have resize_inode. Such combination is invalid to make sure we
|
|
disable resize_inode when enabling meta_bg.
|
|
|
|
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
|
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
---
|
|
lib/ext2fs/initialize.c | 12 +++++++-----
|
|
1 file changed, 7 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
|
|
index 0b8355d8..8f0af1fb 100644
|
|
--- a/lib/ext2fs/initialize.c
|
|
+++ b/lib/ext2fs/initialize.c
|
|
@@ -369,6 +369,13 @@ ipg_retry:
|
|
retval = EXT2_ET_RES_GDT_BLOCKS;
|
|
goto cleanup;
|
|
}
|
|
+ /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
|
|
+ if (super->s_reserved_gdt_blocks + fs->desc_blocks >
|
|
+ super->s_blocks_per_group * 3 / 4) {
|
|
+ fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
|
|
+ fs->super->s_feature_compat &= ~EXT2_FEATURE_COMPAT_RESIZE_INODE;
|
|
+ set_field(s_reserved_gdt_blocks, 0);
|
|
+ }
|
|
|
|
/*
|
|
* Calculate the maximum number of bookkeeping blocks per
|
|
@@ -379,11 +386,6 @@ ipg_retry:
|
|
overhead = (int) (3 + fs->inode_blocks_per_group +
|
|
super->s_reserved_gdt_blocks);
|
|
|
|
- /* Enable meta_bg if we'd lose more than 3/4 of a BG to GDT blocks. */
|
|
- if (super->s_reserved_gdt_blocks + fs->desc_blocks >
|
|
- super->s_blocks_per_group * 3 / 4)
|
|
- fs->super->s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
|
|
-
|
|
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
|
|
overhead++;
|
|
else
|
|
--
|
|
2.20.1
|
|
|