]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ext4: determine group descriptor size for 64bit feature
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Sat, 17 Sep 2016 00:10:07 +0000 (02:10 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 23 Sep 2016 13:18:56 +0000 (09:18 -0400)
If EXT4_FEATURE_INCOMPAT_64BIT is set, the descriptor can be read from
the superblocks, otherwise it defaults to 32.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
fs/ext4/ext4_common.c
include/ext4fs.h

index 5f21dc794805ea7d3f32778fb0293db07c84530f..2df4f8b6d917a75066758a7b1ce520e4974f39e1 100644 (file)
@@ -2233,13 +2233,23 @@ int ext4fs_mount(unsigned part_length)
                goto fail;
        }
 
-       if (le32_to_cpu(data->sblock.revision_level) == 0)
+       if (le32_to_cpu(data->sblock.revision_level) == 0) {
                fs->inodesz = 128;
-       else
+       } else {
+               debug("EXT4 features COMPAT: %08x INCOMPAT: %08x RO_COMPAT: %08x\n",
+                     __le32_to_cpu(data->sblock.feature_compatibility),
+                     __le32_to_cpu(data->sblock.feature_incompat),
+                     __le32_to_cpu(data->sblock.feature_ro_compat));
+
                fs->inodesz = le16_to_cpu(data->sblock.inode_size);
+               fs->gdsize = le32_to_cpu(data->sblock.feature_incompat) &
+                       EXT4_FEATURE_INCOMPAT_64BIT ?
+                       le16_to_cpu(data->sblock.descriptor_size) : 32;
+       }
 
-       debug("EXT2 rev %d, inode_size %d\n",
-              le32_to_cpu(data->sblock.revision_level), fs->inodesz);
+       debug("EXT2 rev %d, inode_size %d, descriptor size %d\n",
+             le32_to_cpu(data->sblock.revision_level),
+             fs->inodesz, fs->gdsize);
 
        data->diropen.data = data;
        data->diropen.ino = 2;
index 6e31c738123434fc499b9704068d26d563e07a0d..7e1ee6c1750c548b6b800813ce1d36e2aef05f05 100644 (file)
@@ -87,6 +87,8 @@ struct ext_filesystem {
        uint32_t inodesz;
        /* Sectors per Block */
        uint32_t sect_perblk;
+       /* Group Descriptor size */
+       uint16_t gdsize;
        /* Group Descriptor Block Number */
        uint32_t gdtable_blkno;
        /* Total block groups of partition */