diff options
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0d96c7d3bb5b..2b81b1324a6f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -40,8 +40,6 @@ | |||
40 | #include "xattr.h" | 40 | #include "xattr.h" |
41 | #include "acl.h" | 41 | #include "acl.h" |
42 | 42 | ||
43 | static int ext4_writepage_trans_blocks(struct inode *inode); | ||
44 | |||
45 | /* | 43 | /* |
46 | * Test whether an inode is a fast symlink. | 44 | * Test whether an inode is a fast symlink. |
47 | */ | 45 | */ |
@@ -804,6 +802,7 @@ int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, | |||
804 | ext4_fsblk_t first_block = 0; | 802 | ext4_fsblk_t first_block = 0; |
805 | 803 | ||
806 | 804 | ||
805 | J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)); | ||
807 | J_ASSERT(handle != NULL || create == 0); | 806 | J_ASSERT(handle != NULL || create == 0); |
808 | depth = ext4_block_to_path(inode,iblock,offsets,&blocks_to_boundary); | 807 | depth = ext4_block_to_path(inode,iblock,offsets,&blocks_to_boundary); |
809 | 808 | ||
@@ -984,7 +983,7 @@ static int ext4_get_block(struct inode *inode, sector_t iblock, | |||
984 | 983 | ||
985 | get_block: | 984 | get_block: |
986 | if (ret == 0) { | 985 | if (ret == 0) { |
987 | ret = ext4_get_blocks_handle(handle, inode, iblock, | 986 | ret = ext4_get_blocks_wrap(handle, inode, iblock, |
988 | max_blocks, bh_result, create, 0); | 987 | max_blocks, bh_result, create, 0); |
989 | if (ret > 0) { | 988 | if (ret > 0) { |
990 | bh_result->b_size = (ret << inode->i_blkbits); | 989 | bh_result->b_size = (ret << inode->i_blkbits); |
@@ -1008,7 +1007,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode, | |||
1008 | dummy.b_state = 0; | 1007 | dummy.b_state = 0; |
1009 | dummy.b_blocknr = -1000; | 1008 | dummy.b_blocknr = -1000; |
1010 | buffer_trace_init(&dummy.b_history); | 1009 | buffer_trace_init(&dummy.b_history); |
1011 | err = ext4_get_blocks_handle(handle, inode, block, 1, | 1010 | err = ext4_get_blocks_wrap(handle, inode, block, 1, |
1012 | &dummy, create, 1); | 1011 | &dummy, create, 1); |
1013 | /* | 1012 | /* |
1014 | * ext4_get_blocks_handle() returns number of blocks | 1013 | * ext4_get_blocks_handle() returns number of blocks |
@@ -1759,7 +1758,7 @@ void ext4_set_aops(struct inode *inode) | |||
1759 | * This required during truncate. We need to physically zero the tail end | 1758 | * This required during truncate. We need to physically zero the tail end |
1760 | * of that block so it doesn't yield old data if the file is later grown. | 1759 | * of that block so it doesn't yield old data if the file is later grown. |
1761 | */ | 1760 | */ |
1762 | static int ext4_block_truncate_page(handle_t *handle, struct page *page, | 1761 | int ext4_block_truncate_page(handle_t *handle, struct page *page, |
1763 | struct address_space *mapping, loff_t from) | 1762 | struct address_space *mapping, loff_t from) |
1764 | { | 1763 | { |
1765 | ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT; | 1764 | ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT; |
@@ -2263,6 +2262,9 @@ void ext4_truncate(struct inode *inode) | |||
2263 | return; | 2262 | return; |
2264 | } | 2263 | } |
2265 | 2264 | ||
2265 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) | ||
2266 | return ext4_ext_truncate(inode, page); | ||
2267 | |||
2266 | handle = start_transaction(inode); | 2268 | handle = start_transaction(inode); |
2267 | if (IS_ERR(handle)) { | 2269 | if (IS_ERR(handle)) { |
2268 | if (page) { | 2270 | if (page) { |
@@ -3003,12 +3005,15 @@ err_out: | |||
3003 | * block and work out the exact number of indirects which are touched. Pah. | 3005 | * block and work out the exact number of indirects which are touched. Pah. |
3004 | */ | 3006 | */ |
3005 | 3007 | ||
3006 | static int ext4_writepage_trans_blocks(struct inode *inode) | 3008 | int ext4_writepage_trans_blocks(struct inode *inode) |
3007 | { | 3009 | { |
3008 | int bpp = ext4_journal_blocks_per_page(inode); | 3010 | int bpp = ext4_journal_blocks_per_page(inode); |
3009 | int indirects = (EXT4_NDIR_BLOCKS % bpp) ? 5 : 3; | 3011 | int indirects = (EXT4_NDIR_BLOCKS % bpp) ? 5 : 3; |
3010 | int ret; | 3012 | int ret; |
3011 | 3013 | ||
3014 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) | ||
3015 | return ext4_ext_writepage_trans_blocks(inode, bpp); | ||
3016 | |||
3012 | if (ext4_should_journal_data(inode)) | 3017 | if (ext4_should_journal_data(inode)) |
3013 | ret = 3 * (bpp + indirects) + 2; | 3018 | ret = 3 * (bpp + indirects) + 2; |
3014 | else | 3019 | else |