diff options
author | Egbert Eich <eich@suse.com> | 2013-05-01 01:13:19 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-05-10 08:16:33 -0400 |
commit | 50ce4c07df1c98aabf4630b35152ed95a87242f7 (patch) | |
tree | c7e506ab5bcb2839a697cb0a89faa3244077cf69 /fs/ext4/ext4fs.c | |
parent | b1e6c4c3d4a2b394096766d959aaa9b51a38099b (diff) | |
download | u-boot-imx-50ce4c07df1c98aabf4630b35152ed95a87242f7.zip u-boot-imx-50ce4c07df1c98aabf4630b35152ed95a87242f7.tar.gz u-boot-imx-50ce4c07df1c98aabf4630b35152ed95a87242f7.tar.bz2 |
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>
Diffstat (limited to 'fs/ext4/ext4fs.c')
-rw-r--r-- | fs/ext4/ext4fs.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index 4dddde2..1954afb 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -60,10 +60,12 @@ void ext4fs_free_node(struct ext2fs_node *node, struct ext2fs_node *currroot) int ext4fs_read_file(struct ext2fs_node *node, int pos, unsigned int len, char *buf) { + struct ext_filesystem *fs = get_fs(); int i; int blockcnt; - int log2blocksize = LOG2_EXT2_BLOCK_SIZE(node->data); - int blocksize = 1 << (log2blocksize + DISK_SECTOR_BITS); + int log2blksz = fs->dev_desc->log2blksz; + int log2_fs_blocksize = LOG2_BLOCK_SIZE(node->data) - log2blksz; + int blocksize = (1 << (log2_fs_blocksize + log2blksz)); unsigned int filesize = __le32_to_cpu(node->inode.size); int previous_block_number = -1; int delayed_start = 0; @@ -88,7 +90,7 @@ int ext4fs_read_file(struct ext2fs_node *node, int pos, if (blknr < 0) return -1; - blknr = blknr << log2blocksize; + blknr = blknr << log2_fs_blocksize; /* Last block. */ if (i == blockcnt - 1) { @@ -110,7 +112,7 @@ int ext4fs_read_file(struct ext2fs_node *node, int pos, if (previous_block_number != -1) { if (delayed_next == blknr) { delayed_extent += blockend; - delayed_next += blockend >> SECTOR_BITS; + delayed_next += blockend >> log2blksz; } else { /* spill */ status = ext4fs_devread(delayed_start, delayed_skipfirst, @@ -124,7 +126,7 @@ int ext4fs_read_file(struct ext2fs_node *node, int pos, delayed_skipfirst = skipfirst; delayed_buf = buf; delayed_next = blknr + - (blockend >> SECTOR_BITS); + (blockend >> log2blksz); } } else { previous_block_number = blknr; @@ -133,7 +135,7 @@ int ext4fs_read_file(struct ext2fs_node *node, int pos, delayed_skipfirst = skipfirst; delayed_buf = buf; delayed_next = blknr + - (blockend >> SECTOR_BITS); + (blockend >> log2blksz); } } else { if (previous_block_number != -1) { |