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