Skip to contentSkip to conversation

fs/ext2: ignore the large_dir incompat feature

PATCH In review Theodore Ts'o 2 participants 2 messages Aug 31, 2022 – Sep 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ext2: ignore the large_dir incompat feature

Recently, ext4 added the a large_dRecently, ext4 added the a large_dir feature, which adds support for a 3 level htree directory support.

Grub supports existing file systems with htree directories by ignoring their existence, and since the index nodes for the hash tree look like deleted directory entries (by design), grub can simply do a brute force O(n) linear search of directories. The same is true for 3 level deep htrees indicated by large_dir feature flag.

Hence, it is safe for gub to ignore the large_dir incompat feature.

---

I submitted this patch back in December 2021, not realizing that apparently no one is actually scanning the bug tracking system on savannah.gnu.org even though it is listed as the official bug tracking system for GRUB. So I'm trying to submit this via grub-devel.

 grub-core/fs/ext2.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
grub-core/fs/ext2.c +9 -1
index 0989e26e1..654580e9d 100644
@@ -104,6 +104,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
 #define EXT4_FEATURE_INCOMPAT_MMP		0x0100
 #define EXT4_FEATURE_INCOMPAT_FLEX_BG		0x0200
 #define EXT4_FEATURE_INCOMPAT_CSUM_SEED		0x2000
+#define EXT4_FEATURE_INCOMPAT_LARGEDIR		0x4000 /* >2GB or 3-lvl htree */
 #define EXT4_FEATURE_INCOMPAT_ENCRYPT          0x10000
 
 /* The set of back-incompatible features this driver DOES support. Add (OR)
@@ -129,10 +130,17 @@ GRUB_MOD_LICENSE ("GPLv3+");
  *                 checksummed filesystem. Safe to ignore for now since the
  *                 driver doesn't support checksum verification. However, it
  *                 has to be removed from this list if the support is added later.
+ * large_dir:      Not back-incompatible given that the grub ext2 driver does
+ *                 not implement EXT2_FEATURE_COMPAT_DIR_INDEX.   If grub
+ *                 eventually supports the htree feature (aka dir_index)
+ *                 it should support 3 level htrees and then move
+ *                 EXT4_FEATURE_INCOMPAT_LARGEDIR to
+ *                 EXT2_DRIVER_SUPPORTED_INCOMPAT.
  */
 #define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \
 				     | EXT4_FEATURE_INCOMPAT_MMP \
-				     | EXT4_FEATURE_INCOMPAT_CSUM_SEED)
+				     | EXT4_FEATURE_INCOMPAT_CSUM_SEED \
+				     | EXT4_FEATURE_INCOMPAT_LARGEDIR)
 
 #define EXT3_JOURNAL_MAGIC_NUMBER	0xc03b3998U
 
Signature · 1 line
2.31.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Theodore Ts'o

Recently, ext4 added the a large_dRecently, ext4 added the a large_dir feature, which adds support for a 3 level htree directory support.

Grub supports existing file systems with htree directories by ignoring their existence, and since the index nodes for the hash tree look like deleted directory entries (by design), grub can simply do a brute force O(n) linear search of directories. The same is true for 3 level deep htrees indicated by large_dir feature flag.

Quoted 5 lines

Hence, it is safe for gub to ignore the large_dir incompat feature.

Quoted 6 lines

---

I submitted this patch back in December 2021, not realizing that apparently no one is actually scanning the bug tracking system on savannah.gnu.org even though it is listed as the official bug tracking system for GRUB. So I'm trying to submit this via grub-devel.

Thank you for sending this to grub-devel. Sadly due to lack of resources we are not able to actively check our bug tracking system. I will update the GRUB web page appropriately. Sorry for inconvenience.

Daniel