summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Brüns <stefan.bruens@rwth-aachen.de>2016-09-17 03:10:07 +0300
committerDongjin Kim <tobetter@gmail.com>2020-02-10 16:44:41 +0300
commit5533f101a2072efbba22839a1b2bcba59d8395eb (patch)
treeb379172ce19a0f86dafc38114bf593ab5b409f8b
parent2b1e1eaa3d8198f5f37f8252b46ea73a64628e3a (diff)
downloadu-boot-5533f101a2072efbba22839a1b2bcba59d8395eb.tar.xz
ext4: determine group descriptor size for 64bit feature
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> Change-Id: I23c1ca650846d7498711c89f9c95962b67359619
-rw-r--r--fs/ext4/ext4_common.c20
-rw-r--r--include/ext4fs.h2
2 files changed, 17 insertions, 5 deletions
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index ff5dbde4e1..d72ea18efe 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -2236,13 +2236,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
- fs->inodesz = __le16_to_cpu(data->sblock.inode_size);
+ } 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;
diff --git a/include/ext4fs.h b/include/ext4fs.h
index cb49e3e23a..7455313b5c 100644
--- a/include/ext4fs.h
+++ b/include/ext4fs.h
@@ -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 */