aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-05-14 00:58:52 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-05-14 00:58:52 -0400
commitc21770573319922e3f3fcb331cfaa290c49f1c81 (patch)
treeee21ebb2d73d4d3b19d7e391e7accf00704371d9 /fs/ext4
parent12b7ac176831df1aa58a787e67c3e5d698b30163 (diff)
ext4: Define a new set of flags for ext4_get_blocks()
The functions ext4_get_blocks(), ext4_ext_get_blocks(), and ext4_ind_get_blocks() used an ad-hoc set of integer variables used as boolean flags passed in as arguments. Use a single flags parameter and a setandard set of bitfield flags instead. This saves space on the call stack, and it also makes the code a bit more understandable. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/dir.c2
-rw-r--r--fs/ext4/ext4.h22
-rw-r--r--fs/ext4/extents.c22
-rw-r--r--fs/ext4/inode.c57
4 files changed, 57 insertions, 46 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 052d6378f997..9dc93168e262 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -131,7 +131,7 @@ static int ext4_readdir(struct file *filp,
131 struct buffer_head *bh = NULL; 131 struct buffer_head *bh = NULL;
132 132
133 map_bh.b_state = 0; 133 map_bh.b_state = 0;
134 err = ext4_get_blocks(NULL, inode, blk, 1, &map_bh, 0, 0, 0); 134 err = ext4_get_blocks(NULL, inode, blk, 1, &map_bh, 0);
135 if (err > 0) { 135 if (err > 0) {
136 pgoff_t index = map_bh.b_blocknr >> 136 pgoff_t index = map_bh.b_blocknr >>
137 (PAGE_CACHE_SHIFT - inode->i_blkbits); 137 (PAGE_CACHE_SHIFT - inode->i_blkbits);
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5dc8368e46bc..17feb4ac633a 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -314,10 +314,20 @@ struct ext4_new_group_data {
314}; 314};
315 315
316/* 316/*
317 * Following is used by preallocation code to tell get_blocks() that we 317 * Flags used by ext4_get_blocks()
318 * want uninitialzed extents.
319 */ 318 */
320#define EXT4_CREATE_UNINITIALIZED_EXT 2 319 /* Allocate any needed blocks and/or convert an unitialized
320 extent to be an initialized ext4 */
321#define EXT4_GET_BLOCKS_CREATE 1
322 /* Request the creation of an unitialized extent */
323#define EXT4_GET_BLOCKS_UNINIT_EXT 2
324#define EXT4_GET_BLOCKS_CREATE_UNINIT_EXT (EXT4_GET_BLOCKS_UNINIT_EXT|\
325 EXT4_GET_BLOCKS_CREATE)
326 /* Update the ext4_inode_info i_disksize field */
327#define EXT4_GET_BLOCKS_EXTEND_DISKSIZE 4
328 /* Caller is from the delayed allocation writeout path,
329 so the filesystem blocks have already been accounted for */
330#define EXT4_GET_BLOCKS_DELALLOC_RESERVE 8
321 331
322/* 332/*
323 * ioctl commands 333 * ioctl commands
@@ -1610,8 +1620,7 @@ extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks,
1610 int chunk); 1620 int chunk);
1611extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 1621extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1612 ext4_lblk_t iblock, unsigned int max_blocks, 1622 ext4_lblk_t iblock, unsigned int max_blocks,
1613 struct buffer_head *bh_result, 1623 struct buffer_head *bh_result, int flags);
1614 int create, int extend_disksize);
1615extern void ext4_ext_truncate(struct inode *); 1624extern void ext4_ext_truncate(struct inode *);
1616extern void ext4_ext_init(struct super_block *); 1625extern void ext4_ext_init(struct super_block *);
1617extern void ext4_ext_release(struct super_block *); 1626extern void ext4_ext_release(struct super_block *);
@@ -1619,8 +1628,7 @@ extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1619 loff_t len); 1628 loff_t len);
1620extern int ext4_get_blocks(handle_t *handle, struct inode *inode, 1629extern int ext4_get_blocks(handle_t *handle, struct inode *inode,
1621 sector_t block, unsigned int max_blocks, 1630 sector_t block, unsigned int max_blocks,
1622 struct buffer_head *bh, int create, 1631 struct buffer_head *bh, int flags);
1623 int extend_disksize, int flag);
1624extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, 1632extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
1625 __u64 start, __u64 len); 1633 __u64 start, __u64 len);
1626 1634
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 7e7d02dd2739..27c383c7b43c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2784,7 +2784,7 @@ fix_extent_len:
2784int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 2784int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2785 ext4_lblk_t iblock, 2785 ext4_lblk_t iblock,
2786 unsigned int max_blocks, struct buffer_head *bh_result, 2786 unsigned int max_blocks, struct buffer_head *bh_result,
2787 int create, int extend_disksize) 2787 int flags)
2788{ 2788{
2789 struct ext4_ext_path *path = NULL; 2789 struct ext4_ext_path *path = NULL;
2790 struct ext4_extent_header *eh; 2790 struct ext4_extent_header *eh;
@@ -2803,7 +2803,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2803 cache_type = ext4_ext_in_cache(inode, iblock, &newex); 2803 cache_type = ext4_ext_in_cache(inode, iblock, &newex);
2804 if (cache_type) { 2804 if (cache_type) {
2805 if (cache_type == EXT4_EXT_CACHE_GAP) { 2805 if (cache_type == EXT4_EXT_CACHE_GAP) {
2806 if (!create) { 2806 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
2807 /* 2807 /*
2808 * block isn't allocated yet and 2808 * block isn't allocated yet and
2809 * user doesn't want to allocate it 2809 * user doesn't want to allocate it
@@ -2869,9 +2869,9 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2869 EXT4_EXT_CACHE_EXTENT); 2869 EXT4_EXT_CACHE_EXTENT);
2870 goto out; 2870 goto out;
2871 } 2871 }
2872 if (create == EXT4_CREATE_UNINITIALIZED_EXT) 2872 if (flags & EXT4_GET_BLOCKS_UNINIT_EXT)
2873 goto out; 2873 goto out;
2874 if (!create) { 2874 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
2875 if (allocated > max_blocks) 2875 if (allocated > max_blocks)
2876 allocated = max_blocks; 2876 allocated = max_blocks;
2877 /* 2877 /*
@@ -2903,7 +2903,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2903 * requested block isn't allocated yet; 2903 * requested block isn't allocated yet;
2904 * we couldn't try to create block if create flag is zero 2904 * we couldn't try to create block if create flag is zero
2905 */ 2905 */
2906 if (!create) { 2906 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
2907 /* 2907 /*
2908 * put just found gap into cache to speed up 2908 * put just found gap into cache to speed up
2909 * subsequent requests 2909 * subsequent requests
@@ -2932,10 +2932,10 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2932 * EXT_UNINIT_MAX_LEN. 2932 * EXT_UNINIT_MAX_LEN.
2933 */ 2933 */
2934 if (max_blocks > EXT_INIT_MAX_LEN && 2934 if (max_blocks > EXT_INIT_MAX_LEN &&
2935 create != EXT4_CREATE_UNINITIALIZED_EXT) 2935 !(flags & EXT4_GET_BLOCKS_UNINIT_EXT))
2936 max_blocks = EXT_INIT_MAX_LEN; 2936 max_blocks = EXT_INIT_MAX_LEN;
2937 else if (max_blocks > EXT_UNINIT_MAX_LEN && 2937 else if (max_blocks > EXT_UNINIT_MAX_LEN &&
2938 create == EXT4_CREATE_UNINITIALIZED_EXT) 2938 (flags & EXT4_GET_BLOCKS_UNINIT_EXT))
2939 max_blocks = EXT_UNINIT_MAX_LEN; 2939 max_blocks = EXT_UNINIT_MAX_LEN;
2940 2940
2941 /* Check if we can really insert (iblock)::(iblock+max_blocks) extent */ 2941 /* Check if we can really insert (iblock)::(iblock+max_blocks) extent */
@@ -2966,7 +2966,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2966 /* try to insert new extent into found leaf and return */ 2966 /* try to insert new extent into found leaf and return */
2967 ext4_ext_store_pblock(&newex, newblock); 2967 ext4_ext_store_pblock(&newex, newblock);
2968 newex.ee_len = cpu_to_le16(ar.len); 2968 newex.ee_len = cpu_to_le16(ar.len);
2969 if (create == EXT4_CREATE_UNINITIALIZED_EXT) /* Mark uninitialized */ 2969 if (flags & EXT4_GET_BLOCKS_UNINIT_EXT) /* Mark uninitialized */
2970 ext4_ext_mark_uninitialized(&newex); 2970 ext4_ext_mark_uninitialized(&newex);
2971 err = ext4_ext_insert_extent(handle, inode, path, &newex); 2971 err = ext4_ext_insert_extent(handle, inode, path, &newex);
2972 if (err) { 2972 if (err) {
@@ -2983,7 +2983,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2983 newblock = ext_pblock(&newex); 2983 newblock = ext_pblock(&newex);
2984 allocated = ext4_ext_get_actual_len(&newex); 2984 allocated = ext4_ext_get_actual_len(&newex);
2985outnew: 2985outnew:
2986 if (extend_disksize) { 2986 if (flags & EXT4_GET_BLOCKS_EXTEND_DISKSIZE) {
2987 disksize = ((loff_t) iblock + ar.len) << inode->i_blkbits; 2987 disksize = ((loff_t) iblock + ar.len) << inode->i_blkbits;
2988 if (disksize > i_size_read(inode)) 2988 if (disksize > i_size_read(inode))
2989 disksize = i_size_read(inode); 2989 disksize = i_size_read(inode);
@@ -2994,7 +2994,7 @@ outnew:
2994 set_buffer_new(bh_result); 2994 set_buffer_new(bh_result);
2995 2995
2996 /* Cache only when it is _not_ an uninitialized extent */ 2996 /* Cache only when it is _not_ an uninitialized extent */
2997 if (create != EXT4_CREATE_UNINITIALIZED_EXT) 2997 if ((flags & EXT4_GET_BLOCKS_UNINIT_EXT) == 0)
2998 ext4_ext_put_in_cache(inode, iblock, allocated, newblock, 2998 ext4_ext_put_in_cache(inode, iblock, allocated, newblock,
2999 EXT4_EXT_CACHE_EXTENT); 2999 EXT4_EXT_CACHE_EXTENT);
3000out: 3000out:
@@ -3153,7 +3153,7 @@ retry:
3153 map_bh.b_state = 0; 3153 map_bh.b_state = 0;
3154 ret = ext4_get_blocks(handle, inode, block, 3154 ret = ext4_get_blocks(handle, inode, block,
3155 max_blocks, &map_bh, 3155 max_blocks, &map_bh,
3156 EXT4_CREATE_UNINITIALIZED_EXT, 0, 0); 3156 EXT4_GET_BLOCKS_CREATE_UNINIT_EXT);
3157 if (ret <= 0) { 3157 if (ret <= 0) {
3158#ifdef EXT4FS_DEBUG 3158#ifdef EXT4FS_DEBUG
3159 WARN_ON(ret <= 0); 3159 WARN_ON(ret <= 0);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a9a9b9b77e8e..8b7564dfacdf 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -917,7 +917,7 @@ err_out:
917static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode, 917static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,
918 ext4_lblk_t iblock, unsigned int maxblocks, 918 ext4_lblk_t iblock, unsigned int maxblocks,
919 struct buffer_head *bh_result, 919 struct buffer_head *bh_result,
920 int create, int extend_disksize) 920 int flags)
921{ 921{
922 int err = -EIO; 922 int err = -EIO;
923 ext4_lblk_t offsets[4]; 923 ext4_lblk_t offsets[4];
@@ -934,7 +934,7 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,
934 934
935 935
936 J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)); 936 J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL));
937 J_ASSERT(handle != NULL || create == 0); 937 J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0);
938 depth = ext4_block_to_path(inode, iblock, offsets, 938 depth = ext4_block_to_path(inode, iblock, offsets,
939 &blocks_to_boundary); 939 &blocks_to_boundary);
940 940
@@ -963,7 +963,7 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,
963 } 963 }
964 964
965 /* Next simple case - plain lookup or failed read of indirect block */ 965 /* Next simple case - plain lookup or failed read of indirect block */
966 if (!create || err == -EIO) 966 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0 || err == -EIO)
967 goto cleanup; 967 goto cleanup;
968 968
969 /* 969 /*
@@ -1002,7 +1002,7 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,
1002 * protect it if you're about to implement concurrent 1002 * protect it if you're about to implement concurrent
1003 * ext4_get_block() -bzzz 1003 * ext4_get_block() -bzzz
1004 */ 1004 */
1005 if (!err && extend_disksize) { 1005 if (!err && (flags & EXT4_GET_BLOCKS_EXTEND_DISKSIZE)) {
1006 disksize = ((loff_t) iblock + count) << inode->i_blkbits; 1006 disksize = ((loff_t) iblock + count) << inode->i_blkbits;
1007 if (disksize > i_size_read(inode)) 1007 if (disksize > i_size_read(inode))
1008 disksize = i_size_read(inode); 1008 disksize = i_size_read(inode);
@@ -1144,7 +1144,7 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1144 */ 1144 */
1145int ext4_get_blocks(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 flags)
1148{ 1148{
1149 int retval; 1149 int retval;
1150 1150
@@ -1158,15 +1158,15 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
1158 down_read((&EXT4_I(inode)->i_data_sem)); 1158 down_read((&EXT4_I(inode)->i_data_sem));
1159 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { 1159 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
1160 retval = ext4_ext_get_blocks(handle, inode, block, max_blocks, 1160 retval = ext4_ext_get_blocks(handle, inode, block, max_blocks,
1161 bh, 0, 0); 1161 bh, 0);
1162 } else { 1162 } else {
1163 retval = ext4_ind_get_blocks(handle, inode, block, max_blocks, 1163 retval = ext4_ind_get_blocks(handle, inode, block, max_blocks,
1164 bh, 0, 0); 1164 bh, 0);
1165 } 1165 }
1166 up_read((&EXT4_I(inode)->i_data_sem)); 1166 up_read((&EXT4_I(inode)->i_data_sem));
1167 1167
1168 /* If it is only a block(s) look up */ 1168 /* If it is only a block(s) look up */
1169 if (!create) 1169 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0)
1170 return retval; 1170 return retval;
1171 1171
1172 /* 1172 /*
@@ -1205,7 +1205,7 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
1205 * let the underlying get_block() function know to 1205 * let the underlying get_block() function know to
1206 * avoid double accounting 1206 * avoid double accounting
1207 */ 1207 */
1208 if (flag) 1208 if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
1209 EXT4_I(inode)->i_delalloc_reserved_flag = 1; 1209 EXT4_I(inode)->i_delalloc_reserved_flag = 1;
1210 /* 1210 /*
1211 * We need to check for EXT4 here because migrate 1211 * We need to check for EXT4 here because migrate
@@ -1213,10 +1213,10 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
1213 */ 1213 */
1214 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { 1214 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
1215 retval = ext4_ext_get_blocks(handle, inode, block, max_blocks, 1215 retval = ext4_ext_get_blocks(handle, inode, block, max_blocks,
1216 bh, create, extend_disksize); 1216 bh, flags);
1217 } else { 1217 } else {
1218 retval = ext4_ind_get_blocks(handle, inode, block, 1218 retval = ext4_ind_get_blocks(handle, inode, block,
1219 max_blocks, bh, create, extend_disksize); 1219 max_blocks, bh, flags);
1220 1220
1221 if (retval > 0 && buffer_new(bh)) { 1221 if (retval > 0 && buffer_new(bh)) {
1222 /* 1222 /*
@@ -1229,7 +1229,7 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
1229 } 1229 }
1230 } 1230 }
1231 1231
1232 if (flag) { 1232 if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) {
1233 EXT4_I(inode)->i_delalloc_reserved_flag = 0; 1233 EXT4_I(inode)->i_delalloc_reserved_flag = 0;
1234 /* 1234 /*
1235 * Update reserved blocks/metadata blocks 1235 * Update reserved blocks/metadata blocks
@@ -1269,7 +1269,7 @@ int ext4_get_block(struct inode *inode, sector_t iblock,
1269 } 1269 }
1270 1270
1271 ret = ext4_get_blocks(handle, inode, iblock, max_blocks, bh_result, 1271 ret = ext4_get_blocks(handle, inode, iblock, max_blocks, bh_result,
1272 create, 0, 0); 1272 create ? EXT4_GET_BLOCKS_CREATE : 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;
@@ -1288,16 +1288,19 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
1288{ 1288{
1289 struct buffer_head dummy; 1289 struct buffer_head dummy;
1290 int fatal = 0, err; 1290 int fatal = 0, err;
1291 int flags = EXT4_GET_BLOCKS_EXTEND_DISKSIZE;
1291 1292
1292 J_ASSERT(handle != NULL || create == 0); 1293 J_ASSERT(handle != NULL || create == 0);
1293 1294
1294 dummy.b_state = 0; 1295 dummy.b_state = 0;
1295 dummy.b_blocknr = -1000; 1296 dummy.b_blocknr = -1000;
1296 buffer_trace_init(&dummy.b_history); 1297 buffer_trace_init(&dummy.b_history);
1297 err = ext4_get_blocks(handle, inode, block, 1, &dummy, create, 1, 0); 1298 if (create)
1299 flags |= EXT4_GET_BLOCKS_CREATE;
1300 err = ext4_get_blocks(handle, inode, block, 1, &dummy, flags);
1298 /* 1301 /*
1299 * ext4_get_blocks() returns number of blocks 1302 * ext4_get_blocks() returns number of blocks mapped. 0 in
1300 * mapped. 0 in case of a HOLE. 1303 * case of a HOLE.
1301 */ 1304 */
1302 if (err > 0) { 1305 if (err > 0) {
1303 if (err > 1) 1306 if (err > 1)
@@ -1997,7 +2000,6 @@ static void ext4_print_free_blocks(struct inode *inode)
1997 return; 2000 return;
1998} 2001}
1999 2002
2000#define EXT4_DELALLOC_RSVED 1
2001static int ext4_da_get_block_write(struct inode *inode, sector_t iblock, 2003static int ext4_da_get_block_write(struct inode *inode, sector_t iblock,
2002 struct buffer_head *bh_result) 2004 struct buffer_head *bh_result)
2003{ 2005{
@@ -2009,7 +2011,8 @@ static int ext4_da_get_block_write(struct inode *inode, sector_t iblock,
2009 handle = ext4_journal_current_handle(); 2011 handle = ext4_journal_current_handle();
2010 BUG_ON(!handle); 2012 BUG_ON(!handle);
2011 ret = ext4_get_blocks(handle, inode, iblock, max_blocks, 2013 ret = ext4_get_blocks(handle, inode, iblock, max_blocks,
2012 bh_result, 1, 0, EXT4_DELALLOC_RSVED); 2014 bh_result, EXT4_GET_BLOCKS_CREATE|
2015 EXT4_GET_BLOCKS_DELALLOC_RESERVE);
2013 if (ret <= 0) 2016 if (ret <= 0)
2014 return ret; 2017 return ret;
2015 2018
@@ -2065,16 +2068,17 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd)
2065 return 0; 2068 return 0;
2066 /* 2069 /*
2067 * We need to make sure the BH_Delay flag is passed down to 2070 * We need to make sure the BH_Delay flag is passed down to
2068 * ext4_da_get_block_write(), since it calls 2071 * ext4_da_get_block_write(), since it calls ext4_get_blocks()
2069 * ext4_get_blocks() with the EXT4_DELALLOC_RSVED flag. 2072 * with the EXT4_GET_BLOCKS_DELALLOC_RESERVE flag. This flag
2070 * This flag causes ext4_get_blocks() to call 2073 * causes ext4_get_blocks() to call
2071 * ext4_da_update_reserve_space() if the passed buffer head 2074 * ext4_da_update_reserve_space() if the passed buffer head
2072 * has the BH_Delay flag set. In the future, once we clean up 2075 * has the BH_Delay flag set. In the future, once we clean up
2073 * the interfaces to ext4_get_blocks(), we should pass in 2076 * the interfaces to ext4_get_blocks(), we should pass in a
2074 * a separate flag which requests that the delayed allocation 2077 * separate flag which requests that the delayed allocation
2075 * statistics should be updated, instead of depending on the 2078 * statistics should be updated, instead of depending on the
2076 * state information getting passed down via the map_bh's 2079 * state information getting passed down via the map_bh's
2077 * state bitmasks plus the magic EXT4_DELALLOC_RSVED flag. 2080 * state bitmasks plus the magic
2081 * EXT4_GET_BLOCKS_DELALLOC_RESERVE flag.
2078 */ 2082 */
2079 new.b_state = mpd->b_state & (1 << BH_Delay); 2083 new.b_state = mpd->b_state & (1 << BH_Delay);
2080 new.b_blocknr = 0; 2084 new.b_blocknr = 0;
@@ -2362,7 +2366,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
2362 * preallocated blocks are unmapped but should treated 2366 * preallocated blocks are unmapped but should treated
2363 * the same as allocated blocks. 2367 * the same as allocated blocks.
2364 */ 2368 */
2365 ret = ext4_get_blocks(NULL, inode, iblock, 1, bh_result, 0, 0, 0); 2369 ret = ext4_get_blocks(NULL, inode, iblock, 1, bh_result, 0);
2366 if ((ret == 0) && !buffer_delay(bh_result)) { 2370 if ((ret == 0) && !buffer_delay(bh_result)) {
2367 /* the block isn't (pre)allocated yet, let's reserve space */ 2371 /* the block isn't (pre)allocated yet, let's reserve space */
2368 /* 2372 /*
@@ -2406,8 +2410,7 @@ static int ext4_normal_get_block_write(struct inode *inode, sector_t iblock,
2406 * we don't want to do block allocation in writepage 2410 * we don't want to do block allocation in writepage
2407 * so call get_block_wrap with create = 0 2411 * so call get_block_wrap with create = 0
2408 */ 2412 */
2409 ret = ext4_get_blocks(NULL, inode, iblock, max_blocks, 2413 ret = ext4_get_blocks(NULL, inode, iblock, max_blocks, bh_result, 0);
2410 bh_result, 0, 0, 0);
2411 if (ret > 0) { 2414 if (ret > 0) {
2412 bh_result->b_size = (ret << inode->i_blkbits); 2415 bh_result->b_size = (ret << inode->i_blkbits);
2413 ret = 0; 2416 ret = 0;