|
@@ -1121,7 +1121,7 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * The ext4_get_blocks_wrap() function try to look up the requested blocks,
|
|
|
|
|
|
+ * The ext4_get_blocks() function tries to look up the requested blocks,
|
|
* and returns if the blocks are already mapped.
|
|
* and returns if the blocks are already mapped.
|
|
*
|
|
*
|
|
* Otherwise it takes the write lock of the i_data_sem and allocate blocks
|
|
* 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)
|
|
*
|
|
*
|
|
* It returns the error in case of allocation failure.
|
|
* It returns the error in case of allocation failure.
|
|
*/
|
|
*/
|
|
-int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
|
|
|
|
- unsigned int max_blocks, struct buffer_head *bh,
|
|
|
|
- int create, int extend_disksize, int flag)
|
|
|
|
|
|
+int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
|
|
|
|
+ unsigned int max_blocks, struct buffer_head *bh,
|
|
|
|
+ int create, int extend_disksize, int flag)
|
|
{
|
|
{
|
|
int retval;
|
|
int retval;
|
|
|
|
|
|
@@ -1268,8 +1268,8 @@ int ext4_get_block(struct inode *inode, sector_t iblock,
|
|
started = 1;
|
|
started = 1;
|
|
}
|
|
}
|
|
|
|
|
|
- ret = ext4_get_blocks_wrap(handle, inode, iblock,
|
|
|
|
- max_blocks, bh_result, create, 0, 0);
|
|
|
|
|
|
+ ret = ext4_get_blocks(handle, inode, iblock, max_blocks, bh_result,
|
|
|
|
+ create, 0, 0);
|
|
if (ret > 0) {
|
|
if (ret > 0) {
|
|
bh_result->b_size = (ret << inode->i_blkbits);
|
|
bh_result->b_size = (ret << inode->i_blkbits);
|
|
ret = 0;
|
|
ret = 0;
|
|
@@ -1294,10 +1294,9 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
|
|
dummy.b_state = 0;
|
|
dummy.b_state = 0;
|
|
dummy.b_blocknr = -1000;
|
|
dummy.b_blocknr = -1000;
|
|
buffer_trace_init(&dummy.b_history);
|
|
buffer_trace_init(&dummy.b_history);
|
|
- err = ext4_get_blocks_wrap(handle, inode, block, 1,
|
|
|
|
- &dummy, create, 1, 0);
|
|
|
|
|
|
+ err = ext4_get_blocks(handle, inode, block, 1, &dummy, create, 1, 0);
|
|
/*
|
|
/*
|
|
- * ext4_get_blocks_wrap() returns number of blocks
|
|
|
|
|
|
+ * ext4_get_blocks() returns number of blocks
|
|
* mapped. 0 in case of a HOLE.
|
|
* mapped. 0 in case of a HOLE.
|
|
*/
|
|
*/
|
|
if (err > 0) {
|
|
if (err > 0) {
|
|
@@ -2009,8 +2008,8 @@ static int ext4_da_get_block_write(struct inode *inode, sector_t iblock,
|
|
|
|
|
|
handle = ext4_journal_current_handle();
|
|
handle = ext4_journal_current_handle();
|
|
BUG_ON(!handle);
|
|
BUG_ON(!handle);
|
|
- ret = ext4_get_blocks_wrap(handle, inode, iblock, max_blocks,
|
|
|
|
- bh_result, 1, 0, EXT4_DELALLOC_RSVED);
|
|
|
|
|
|
+ ret = ext4_get_blocks(handle, inode, iblock, max_blocks,
|
|
|
|
+ bh_result, 1, 0, EXT4_DELALLOC_RSVED);
|
|
if (ret <= 0)
|
|
if (ret <= 0)
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
@@ -2067,11 +2066,11 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd)
|
|
/*
|
|
/*
|
|
* We need to make sure the BH_Delay flag is passed down to
|
|
* We need to make sure the BH_Delay flag is passed down to
|
|
* ext4_da_get_block_write(), since it calls
|
|
* ext4_da_get_block_write(), since it calls
|
|
- * ext4_get_blocks_wrap() with the EXT4_DELALLOC_RSVED flag.
|
|
|
|
- * This flag causes ext4_get_blocks_wrap() to call
|
|
|
|
|
|
+ * ext4_get_blocks() with the EXT4_DELALLOC_RSVED flag.
|
|
|
|
+ * This flag causes ext4_get_blocks() to call
|
|
* ext4_da_update_reserve_space() if the passed buffer head
|
|
* ext4_da_update_reserve_space() if the passed buffer head
|
|
* has the BH_Delay flag set. In the future, once we clean up
|
|
* has the BH_Delay flag set. In the future, once we clean up
|
|
- * the interfaces to ext4_get_blocks_wrap(), we should pass in
|
|
|
|
|
|
+ * the interfaces to ext4_get_blocks(), we should pass in
|
|
* a separate flag which requests that the delayed allocation
|
|
* a separate flag which requests that the delayed allocation
|
|
* statistics should be updated, instead of depending on the
|
|
* statistics should be updated, instead of depending on the
|
|
* state information getting passed down via the map_bh's
|
|
* 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,
|
|
* preallocated blocks are unmapped but should treated
|
|
* preallocated blocks are unmapped but should treated
|
|
* the same as allocated blocks.
|
|
* the same as allocated blocks.
|
|
*/
|
|
*/
|
|
- ret = ext4_get_blocks_wrap(NULL, inode, iblock, 1, bh_result, 0, 0, 0);
|
|
|
|
|
|
+ ret = ext4_get_blocks(NULL, inode, iblock, 1, bh_result, 0, 0, 0);
|
|
if ((ret == 0) && !buffer_delay(bh_result)) {
|
|
if ((ret == 0) && !buffer_delay(bh_result)) {
|
|
/* the block isn't (pre)allocated yet, let's reserve space */
|
|
/* the block isn't (pre)allocated yet, let's reserve space */
|
|
/*
|
|
/*
|
|
@@ -2407,8 +2406,8 @@ static int ext4_normal_get_block_write(struct inode *inode, sector_t iblock,
|
|
* we don't want to do block allocation in writepage
|
|
* we don't want to do block allocation in writepage
|
|
* so call get_block_wrap with create = 0
|
|
* so call get_block_wrap with create = 0
|
|
*/
|
|
*/
|
|
- ret = ext4_get_blocks_wrap(NULL, inode, iblock, max_blocks,
|
|
|
|
- bh_result, 0, 0, 0);
|
|
|
|
|
|
+ ret = ext4_get_blocks(NULL, inode, iblock, max_blocks,
|
|
|
|
+ bh_result, 0, 0, 0);
|
|
if (ret > 0) {
|
|
if (ret > 0) {
|
|
bh_result->b_size = (ret << inode->i_blkbits);
|
|
bh_result->b_size = (ret << inode->i_blkbits);
|
|
ret = 0;
|
|
ret = 0;
|
|
@@ -5034,7 +5033,7 @@ int ext4_writepage_trans_blocks(struct inode *inode)
|
|
* Calculate the journal credits for a chunk of data modification.
|
|
* Calculate the journal credits for a chunk of data modification.
|
|
*
|
|
*
|
|
* This is called from DIO, fallocate or whoever calling
|
|
* This is called from DIO, fallocate or whoever calling
|
|
- * ext4_get_blocks_wrap() to map/allocate a chunk of contigous disk blocks.
|
|
|
|
|
|
+ * ext4_get_blocks() to map/allocate a chunk of contigous disk blocks.
|
|
*
|
|
*
|
|
* journal buffers for data blocks are not included here, as DIO
|
|
* journal buffers for data blocks are not included here, as DIO
|
|
* and fallocate do no need to journal data buffers.
|
|
* and fallocate do no need to journal data buffers.
|