diff options
Diffstat (limited to 'fs/ext2/inode.c')
-rw-r--r-- | fs/ext2/inode.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index d831e24dc885..41b8b44a391c 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -622,7 +622,7 @@ static int ext2_get_blocks(struct inode *inode, | |||
622 | u32 *bno, bool *new, bool *boundary, | 622 | u32 *bno, bool *new, bool *boundary, |
623 | int create) | 623 | int create) |
624 | { | 624 | { |
625 | int err = -EIO; | 625 | int err; |
626 | int offsets[4]; | 626 | int offsets[4]; |
627 | Indirect chain[4]; | 627 | Indirect chain[4]; |
628 | Indirect *partial; | 628 | Indirect *partial; |
@@ -639,7 +639,7 @@ static int ext2_get_blocks(struct inode *inode, | |||
639 | depth = ext2_block_to_path(inode,iblock,offsets,&blocks_to_boundary); | 639 | depth = ext2_block_to_path(inode,iblock,offsets,&blocks_to_boundary); |
640 | 640 | ||
641 | if (depth == 0) | 641 | if (depth == 0) |
642 | return (err); | 642 | return -EIO; |
643 | 643 | ||
644 | partial = ext2_get_branch(inode, depth, offsets, chain, &err); | 644 | partial = ext2_get_branch(inode, depth, offsets, chain, &err); |
645 | /* Simplest case - block found, no allocation needed */ | 645 | /* Simplest case - block found, no allocation needed */ |
@@ -761,7 +761,6 @@ static int ext2_get_blocks(struct inode *inode, | |||
761 | ext2_splice_branch(inode, iblock, partial, indirect_blks, count); | 761 | ext2_splice_branch(inode, iblock, partial, indirect_blks, count); |
762 | mutex_unlock(&ei->truncate_mutex); | 762 | mutex_unlock(&ei->truncate_mutex); |
763 | got_it: | 763 | got_it: |
764 | *bno = le32_to_cpu(chain[depth-1].key); | ||
765 | if (count > blocks_to_boundary) | 764 | if (count > blocks_to_boundary) |
766 | *boundary = true; | 765 | *boundary = true; |
767 | err = count; | 766 | err = count; |
@@ -772,6 +771,8 @@ cleanup: | |||
772 | brelse(partial->bh); | 771 | brelse(partial->bh); |
773 | partial--; | 772 | partial--; |
774 | } | 773 | } |
774 | if (err > 0) | ||
775 | *bno = le32_to_cpu(chain[depth-1].key); | ||
775 | return err; | 776 | return err; |
776 | } | 777 | } |
777 | 778 | ||