diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2017-03-20 15:35:31 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-30 08:23:19 +0200 |
commit | 18f01ff3eb1da7b2da4679bdd3fd1e3ce91e699d (patch) | |
tree | 345f290fae8b5b48e957714e77a1c223b6b75230 /fs/ext4 | |
parent | 074d4123edbae73271ddc2791410d7c444445738 (diff) | |
download | barebox-18f01ff3eb1da7b2da4679bdd3fd1e3ce91e699d.tar.gz barebox-18f01ff3eb1da7b2da4679bdd3fd1e3ce91e699d.tar.xz |
ext4: determine group descriptor size for 64bit feature
This is an adoption of the U-Boot commits
| commit fc214ef90910159f33fbe92a6cb77839a27fa8a6
| Author: Stefan Brüns <stefan.bruens@rwth-aachen.de>
| Date: Sat Sep 17 02:10:07 2016 +0200
|
| 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>
| commit 3cc5bbb8e68dc67b7c3d2fdebef69408e5271469
| Author: Stefan Brüns <stefan.bruens@rwth-aachen.de>
| Date: Tue Dec 27 02:35:08 2016 +0100
|
| fs/ext4: Initialize group descriptor size for revision level 0 filesystems
|
| genext2fs creates revision level 0 filesystems, which are not readable
| by u-boot due to the initialized group descriptor size field.
| f798b1dda1c5de818b806189e523d1b75db7e72d
|
| Reported-by: Kever Yang <kever.yang@rock-chips.com>
| Reported-by: FrostyBytes@protonmail.com
| Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
| Tested-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4_common.c | 19 | ||||
-rw-r--r-- | fs/ext4/ext4fs.h | 3 |
2 files changed, 18 insertions, 4 deletions
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 9cbe3dbb1a..f35eebc217 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -506,13 +506,24 @@ int ext4fs_mount(struct ext_filesystem *fs) 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->gdsize = 32; + } 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; + } - dev_info(fs->dev, "EXT2 rev %d, inode_size %d\n", - le32_to_cpu(data->sblock.revision_level), fs->inodesz); + dev_info(fs->dev, "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/fs/ext4/ext4fs.h b/fs/ext4/ext4fs.h index ead212d97a..17a490a943 100644 --- a/fs/ext4/ext4fs.h +++ b/fs/ext4/ext4fs.h @@ -28,6 +28,7 @@ #define EXT4_EXT_MAGIC 0xf30a #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 +#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 #define EXT4_INDIRECT_BLOCKS 12 #define EXT4_BG_INODE_UNINIT 0x0001 @@ -81,6 +82,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 */ |