fs/ext4: Support device block sizes != 512 bytes

The 512 byte block size was hard coded in the ext4 file systems.
Large harddisks today support bigger block sizes typically 4096
bytes.
This patch removes this limitation.

Signed-off-by: Egbert Eich <eich@suse.com>
This commit is contained in:
Egbert Eich 2013-05-01 01:13:19 +00:00 committed by Tom Rini
parent b1e6c4c3d4
commit 50ce4c07df
8 changed files with 95 additions and 76 deletions

View file

@ -34,7 +34,6 @@
#define __EXT_COMMON__
#include <command.h>
#define SECTOR_SIZE 0x200
#define SECTOR_BITS 9
/* Magic value used to identify an ext2 filesystem. */
#define EXT2_MAGIC 0xEF53
@ -58,18 +57,13 @@
#define FILETYPE_INO_SYMLINK 0120000
#define EXT2_ROOT_INO 2 /* Root inode */
/* Bits used as offset in sector */
#define DISK_SECTOR_BITS 9
/* The size of an ext2 block in bytes. */
#define EXT2_BLOCK_SIZE(data) (1 << LOG2_BLOCK_SIZE(data))
/* Log2 size of ext2 block in 512 blocks. */
#define LOG2_EXT2_BLOCK_SIZE(data) (__le32_to_cpu \
(data->sblock.log2_block_size) + 1)
/* Log2 size of ext2 block in bytes. */
#define LOG2_BLOCK_SIZE(data) (__le32_to_cpu \
(data->sblock.log2_block_size) + 10)
#define LOG2_BLOCK_SIZE(data) (__le32_to_cpu \
(data->sblock.log2_block_size) \
+ EXT2_MIN_BLOCK_LOG_SIZE)
#define INODE_SIZE_FILESYSTEM(data) (__le32_to_cpu \
(data->sblock.inode_size))