From: Andrew Morton cross-port the missed 5dea5176e5c32ef9f0d1a41d28427b3bf6881b3a Cc: "Martin J. Bligh" Cc: Valerie Henson Cc: Mingming Cao Signed-off-by: Andrew Morton --- fs/ext2/inode.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff -puN fs/ext2/inode.c~ext2-reservations-multile-block-allocate-little-endian-fixes fs/ext2/inode.c --- a/fs/ext2/inode.c~ext2-reservations-multile-block-allocate-little-endian-fixes +++ a/fs/ext2/inode.c @@ -529,7 +529,7 @@ static void ext2_splice_branch(struct in * direct blocks blocks */ if (num == 0 && blks > 1) { - current_block = le32_to_cpu(where->key + 1); + current_block = le32_to_cpu(where->key) + 1; for (i = 1; i < blks; i++) *(where->p + i ) = cpu_to_le32(current_block++); } @@ -542,7 +542,7 @@ static void ext2_splice_branch(struct in if (block_i) { block_i->last_alloc_logical_block = block + blks - 1; block_i->last_alloc_physical_block = - le32_to_cpu(where[num].key + blks - 1); + le32_to_cpu(where[num].key) + blks - 1; } /* We are done with atomic stuff, now do the rest of housekeeping */ @@ -600,11 +600,13 @@ reread: /* Simplest case - block found, no allocation needed */ if (!partial) { - first_block = chain[depth - 1].key; + first_block = le32_to_cpu(chain[depth - 1].key); clear_buffer_new(bh_result); /* What's this do? */ count++; /*map more blocks*/ while (count < maxblocks && count <= blocks_to_boundary) { + unsigned long blk; + if (!verify_chain(chain, partial)) { /* * Indirect block might be removed by @@ -615,8 +617,8 @@ reread: count = 0; goto changed; } - if (le32_to_cpu(*(chain[depth-1].p+count) == - (first_block + count))) + blk = le32_to_cpu(*(chain[depth-1].p + count)); + if (blk == first_block + count) count++; else break; _