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