ext4: fix calculating inode blkcount for non-512 blocksize filesystems
A message that is not in the archive (sent off-list or not yet received): CGME20190621133316eucas1p2dc0538511904be2f0efe8fceccb823bb@eucas1p2.samsung.com
PATCH 1/1 ext4: fix calculating inode blkcount for non-512 blocksize filesystems
The block count entry in the EXT4 filesystem disk structures uses standard 512-bytes units for most of the typical files. The only exception are HUGE files, which use the filesystem block size, but those are not supported by uboot's EXT4 implementation anyway. This patch fixes the EXT4 code to use proper unit count for inode block count. This fixes errors reported by fsck.ext4 on disks with non-standard (i.e. 4KiB, in case of new flash drives) PHYSICAL block size after using 'ext4write' uboot's command.
--- fs/ext4/ext4_common.c | 2 +- fs/ext4/ext4_write.c | 2 +- include/ext_common.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
fs/ext4/ext4_common.c +1 -1
@@ -570,7 +570,7 @@ restart_read: g_parent_inode->size =cpu_to_le32 (new_size); new_blockcnt =le32_to_cpu (g_parent_inode->blockcnt); - new_blockcnt += fs->sect_perblk; + new_blockcnt += fs->blksz >>LOG2_SECTOR_SIZE ; g_parent_inode->blockcnt =cpu_to_le32 (new_blockcnt); if (ext4fs_put_metadata
fs/ext4/ext4_write.c +1 -1
@@ -957,7 +957,7 @@ int ext4fs_write(const char *fname, const char *buffer,ext4fs_allocate_blocks (file_inode, blocks_remaining, &blks_reqd_for_file); file_inode->blockcnt =cpu_to_le32 ((blks_reqd_for_file * fs->blksz) >> - fs->dev_desc->log2blksz); +LOG2_SECTOR_SIZE ); temp_ptr =zalloc (fs->blksz);if (!temp_ptr)
include/ext_common.h +1 -0
@@ -21,6 +21,7 @@#define __EXT_COMMON__#include <command.h> #define SECTOR_SIZE 0x200 +#define LOG2_SECTOR_SIZE 9/* Magic value used to identify an ext2 filesystem. */ #define EXT2_MAGIC 0xEF53
Signature · 1 line
2.17.1
PATCH 1/1 ext4: fix calculating inode blkcount for non-512 blocksize filesystems
Quoted 49 lines · On Fri, 21 Jun 2019 15:32:51 +0200 Marek Szyprowski <[email protected]>…
The block count entry in the EXT4 filesystem disk structures uses standard 512-bytes units for most of the typical files. The only exception are HUGE files, which use the filesystem block size, but those are not supported by uboot's EXT4 implementation anyway. This patch fixes the EXT4 code to use proper unit count for inode block count. This fixes errors reported by fsck.ext4 on disks with non-standard (i.e. 4KiB, in case of new flash drives) PHYSICAL block size after using 'ext4write' uboot's command.
Signed-off-by Marek Szyprowski <[email protected]>--- fs/ext4/ext4_common.c | 2 +- fs/ext4/ext4_write.c | 2 +- include/ext_common.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)fs/ext4/ext4_common.c +1
-1@@ -570,7 +570,7 @@ restart_read: g_parent_inode->size =cpu_to_le32 (new_size); new_blockcnt =le32_to_cpu (g_parent_inode->blockcnt); - new_blockcnt += fs->sect_perblk; + new_blockcnt += fs->blksz >>
LOG2_SECTOR_SIZE;g_parent_inode->blockcnt=cpu_to_le32(new_blockcnt);fs/ext4/ext4_common.c +0
-0if (ext4fs_put_metadatafs/ext4/ext4_write.c +0
-0@@ -957,7 +957,7 @@ int ext4fs_write(const char *fname, const char *buffer,ext4fs_allocate_blocks (file_inode, blocks_remaining, &blks_reqd_for_file); file_inode->blockcnt = cpu_to_le32((blks_reqd_for_file *
fs->blksz) >>fs/ext4/ext4_write.c +1
-1- fs->dev_desc->log2blksz); + LOG2_SECTOR_SIZE); temp_ptr =zalloc (fs->blksz);if (!temp_ptr)include/ext_common.h +0
-0
include/ext_common.h line 27
Quoted 7 lines
include/ext_common.h +1
-0@@ -21,6 +21,7 @@#define __EXT_COMMON__#include <command.h> #define SECTOR_SIZE 0x200 +#define LOG2_SECTOR_SIZE 9/* Magic value used to identify an ext2 filesystem. */ #define EXT2_MAGIC 0xEF53
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190624/474186e5/attachment.sig>
PATCH 1/1 ext4: fix calculating inode blkcount for non-512 blocksize filesystems
In reply to Marek SzyprowskiQuoted 11 lines · Marek Szyprowski
The block count entry in the EXT4 filesystem disk structures uses standard 512-bytes units for most of the typical files. The only exception are HUGE files, which use the filesystem block size, but those are not supported by uboot's EXT4 implementation anyway. This patch fixes the EXT4 code to use proper unit count for inode block count. This fixes errors reported by fsck.ext4 on disks with non-standard (i.e. 4KiB, in case of new flash drives) PHYSICAL block size after using 'ext4write' uboot's command.
Signed-off-by Marek Szyprowski <[email protected]>Reviewed-by Lukasz Majewski <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/9630186d/attachment.sig>