diff options
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d04c8428bde2..5a8979259c9a 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -562,15 +562,21 @@ static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind) | |||
562 | * | 562 | * |
563 | * Normally this function find the preferred place for block allocation, | 563 | * Normally this function find the preferred place for block allocation, |
564 | * returns it. | 564 | * returns it. |
565 | * Because this is only used for non-extent files, we limit the block nr | ||
566 | * to 32 bits. | ||
565 | */ | 567 | */ |
566 | static ext4_fsblk_t ext4_find_goal(struct inode *inode, ext4_lblk_t block, | 568 | static ext4_fsblk_t ext4_find_goal(struct inode *inode, ext4_lblk_t block, |
567 | Indirect *partial) | 569 | Indirect *partial) |
568 | { | 570 | { |
571 | ext4_fsblk_t goal; | ||
572 | |||
569 | /* | 573 | /* |
570 | * XXX need to get goal block from mballoc's data structures | 574 | * XXX need to get goal block from mballoc's data structures |
571 | */ | 575 | */ |
572 | 576 | ||
573 | return ext4_find_near(inode, partial); | 577 | goal = ext4_find_near(inode, partial); |
578 | goal = goal & EXT4_MAX_BLOCK_FILE_PHYS; | ||
579 | return goal; | ||
574 | } | 580 | } |
575 | 581 | ||
576 | /** | 582 | /** |
@@ -651,6 +657,8 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, | |||
651 | if (*err) | 657 | if (*err) |
652 | goto failed_out; | 658 | goto failed_out; |
653 | 659 | ||
660 | BUG_ON(current_block + count > EXT4_MAX_BLOCK_FILE_PHYS); | ||
661 | |||
654 | target -= count; | 662 | target -= count; |
655 | /* allocate blocks for indirect blocks */ | 663 | /* allocate blocks for indirect blocks */ |
656 | while (index < indirect_blks && count) { | 664 | while (index < indirect_blks && count) { |
@@ -685,6 +693,7 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, | |||
685 | ar.flags = EXT4_MB_HINT_DATA; | 693 | ar.flags = EXT4_MB_HINT_DATA; |
686 | 694 | ||
687 | current_block = ext4_mb_new_blocks(handle, &ar, err); | 695 | current_block = ext4_mb_new_blocks(handle, &ar, err); |
696 | BUG_ON(current_block + ar.len > EXT4_MAX_BLOCK_FILE_PHYS); | ||
688 | 697 | ||
689 | if (*err && (target == blks)) { | 698 | if (*err && (target == blks)) { |
690 | /* | 699 | /* |