aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f758e8021d1a..a9a9b9b77e8e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1121,7 +1121,7 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1121} 1121}
1122 1122
1123/* 1123/*
1124 * The ext4_get_blocks_wrap() function try to look up the requested blocks, 1124 * The ext4_get_blocks() function tries to look up the requested blocks,
1125 * and returns if the blocks are already mapped. 1125 * and returns if the blocks are already mapped.
1126 * 1126 *
1127 * Otherwise it takes the write lock of the i_data_sem and allocate blocks 1127 * Otherwise it takes the write lock of the i_data_sem and allocate blocks
@@ -1142,9 +1142,9 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1142 * 1142 *
1143 * It returns the error in case of allocation failure. 1143 * It returns the error in case of allocation failure.
1144 */ 1144 */
1145int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, 1145int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
1146 unsigned int max_blocks, struct buffer_head *bh, 1146 unsigned int max_blocks, struct buffer_head *bh,
1147 int create, int extend_disksize, int flag) 1147 int create, int extend_disksize, int flag)
1148{ 1148{
1149 int retval; 1149 int retval;
1150 1150
@@ -1268,8 +1268,8 @@ int ext4_get_block(struct inode *inode, sector_t iblock,
1268 started = 1; 1268 started = 1;
1269 } 1269 }
1270 1270
1271 ret = ext4_get_blocks_wrap(handle, inode, iblock, 1271 ret = ext4_get_blocks(handle, inode, iblock, max_blocks, bh_result,
1272 max_blocks, bh_result, create, 0, 0); 1272 create, 0, 0);
1273 if (ret > 0) { 1273 if (ret > 0) {
1274 bh_result->b_size = (ret << inode->i_blkbits); 1274 bh_result->b_size = (ret << inode->i_blkbits);
1275 ret = 0; 1275 ret = 0;
@@ -1294,10 +1294,9 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
1294 dummy.b_state = 0; 1294 dummy.b_state = 0;
1295 dummy.b_blocknr = -1000; 1295 dummy.b_blocknr = -1000;
1296 buffer_trace_init(&dummy.b_history); 1296 buffer_trace_init(&dummy.b_history);
1297 err = ext4_get_blocks_wrap(handle, inode, block, 1, 1297 err = ext4_get_blocks(handle, inode, block, 1, &dummy, create, 1, 0);
1298 &dummy, create, 1, 0);
1299 /* 1298 /*
1300 * ext4_get_blocks_wrap() returns number of blocks 1299 * ext4_get_blocks() returns number of blocks
1301 * mapped. 0 in case of a HOLE. 1300 * mapped. 0 in case of a HOLE.
1302 */ 1301 */
1303 if (err > 0) { 1302 if (err > 0) {
@@ -2009,8 +2008,8 @@ static int ext4_da_get_block_write(struct inode *inode, sector_t iblock,
2009 2008
2010 handle = ext4_journal_current_handle(); 2009 handle = ext4_journal_current_handle();
2011 BUG_ON(!handle); 2010 BUG_ON(!handle);
2012 ret = ext4_get_blocks_wrap(handle, inode, iblock, max_blocks, 2011 ret = ext4_get_blocks(handle, inode, iblock, max_blocks,
2013 bh_result, 1, 0, EXT4_DELALLOC_RSVED); 2012 bh_result, 1, 0, EXT4_DELALLOC_RSVED);
2014 if (ret <= 0) 2013 if (ret <= 0)
2015 return ret; 2014 return ret;
2016 2015
@@ -2067,11 +2066,11 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd)
2067 /* 2066 /*
2068 * We need to make sure the BH_Delay flag is passed down to 2067 * We need to make sure the BH_Delay flag is passed down to
2069 * ext4_da_get_block_write(), since it calls 2068 * ext4_da_get_block_write(), since it calls
2070 * ext4_get_blocks_wrap() with the EXT4_DELALLOC_RSVED flag. 2069 * ext4_get_blocks() with the EXT4_DELALLOC_RSVED flag.
2071 * This flag causes ext4_get_blocks_wrap() to call 2070 * This flag causes ext4_get_blocks() to call
2072 * ext4_da_update_reserve_space() if the passed buffer head 2071 * ext4_da_update_reserve_space() if the passed buffer head
2073 * has the BH_Delay flag set. In the future, once we clean up 2072 * has the BH_Delay flag set. In the future, once we clean up
2074 * the interfaces to ext4_get_blocks_wrap(), we should pass in 2073 * the interfaces to ext4_get_blocks(), we should pass in
2075 * a separate flag which requests that the delayed allocation 2074 * a separate flag which requests that the delayed allocation
2076 * statistics should be updated, instead of depending on the 2075 * statistics should be updated, instead of depending on the
2077 * state information getting passed down via the map_bh's 2076 * state information getting passed down via the map_bh's
@@ -2363,7 +2362,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
2363 * preallocated blocks are unmapped but should treated 2362 * preallocated blocks are unmapped but should treated
2364 * the same as allocated blocks. 2363 * the same as allocated blocks.
2365 */ 2364 */
2366 ret = ext4_get_blocks_wrap(NULL, inode, iblock, 1, bh_result, 0, 0, 0); 2365 ret = ext4_get_blocks(NULL, inode, iblock, 1, bh_result, 0, 0, 0);
2367 if ((ret == 0) && !buffer_delay(bh_result)) { 2366 if ((ret == 0) && !buffer_delay(bh_result)) {
2368 /* the block isn't (pre)allocated yet, let's reserve space */ 2367 /* the block isn't (pre)allocated yet, let's reserve space */
2369 /* 2368 /*
@@ -2407,8 +2406,8 @@ static int ext4_normal_get_block_write(struct inode *inode, sector_t iblock,
2407 * we don't want to do block allocation in writepage 2406 * we don't want to do block allocation in writepage
2408 * so call get_block_wrap with create = 0 2407 * so call get_block_wrap with create = 0
2409 */ 2408 */
2410 ret = ext4_get_blocks_wrap(NULL, inode, iblock, max_blocks, 2409 ret = ext4_get_blocks(NULL, inode, iblock, max_blocks,
2411 bh_result, 0, 0, 0); 2410 bh_result, 0, 0, 0);
2412 if (ret > 0) { 2411 if (ret > 0) {
2413 bh_result->b_size = (ret << inode->i_blkbits); 2412 bh_result->b_size = (ret << inode->i_blkbits);
2414 ret = 0; 2413 ret = 0;
@@ -5034,7 +5033,7 @@ int ext4_writepage_trans_blocks(struct inode *inode)
5034 * Calculate the journal credits for a chunk of data modification. 5033 * Calculate the journal credits for a chunk of data modification.
5035 * 5034 *
5036 * This is called from DIO, fallocate or whoever calling 5035 * This is called from DIO, fallocate or whoever calling
5037 * ext4_get_blocks_wrap() to map/allocate a chunk of contigous disk blocks. 5036 * ext4_get_blocks() to map/allocate a chunk of contigous disk blocks.
5038 * 5037 *
5039 * journal buffers for data blocks are not included here, as DIO 5038 * journal buffers for data blocks are not included here, as DIO
5040 * and fallocate do no need to journal data buffers. 5039 * and fallocate do no need to journal data buffers.