aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-06-09 00:17:05 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-06-09 00:17:05 -0400
commit03f5d8bcf094a5e3b501bd2ae1553656efa8d1be (patch)
tree04644e9008e7357fd87f14fee6404b7c306bc3e9 /fs/ext4
parent0b8e58a140cae2ba1c4a21ccae7c6c3c939c51f9 (diff)
ext4: Get rid of EXTEND_DISKSIZE flag of ext4_get_blocks_handle()
Get rid of EXTEND_DISKSIZE flag of ext4_get_blocks_handle(). This seems to be a relict from some old days and setting disksize in this function does not make much sense. Currently it was set only by ext4_getblk(). Since the parameter has some effect only if create == 1, it is easy to check by grepping through the sources that the three callers which end up calling ext4_getblk() with create == 1 (ext4_append, ext4_quota_write, ext4_mkdir) do the right thing and set disksize themselves. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ext4.h6
-rw-r--r--fs/ext4/extents.c9
-rw-r--r--fs/ext4/inode.c23
3 files changed, 5 insertions, 33 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 4311cc85b534..59657ff7b8f4 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -323,15 +323,13 @@ struct ext4_new_group_data {
323#define EXT4_GET_BLOCKS_UNINIT_EXT 0x0002 323#define EXT4_GET_BLOCKS_UNINIT_EXT 0x0002
324#define EXT4_GET_BLOCKS_CREATE_UNINIT_EXT (EXT4_GET_BLOCKS_UNINIT_EXT|\ 324#define EXT4_GET_BLOCKS_CREATE_UNINIT_EXT (EXT4_GET_BLOCKS_UNINIT_EXT|\
325 EXT4_GET_BLOCKS_CREATE) 325 EXT4_GET_BLOCKS_CREATE)
326 /* Update the ext4_inode_info i_disksize field */
327#define EXT4_GET_BLOCKS_EXTEND_DISKSIZE 0x0004
328 /* Caller is from the delayed allocation writeout path, 326 /* Caller is from the delayed allocation writeout path,
329 so set the magic i_delalloc_reserve_flag after taking the 327 so set the magic i_delalloc_reserve_flag after taking the
330 inode allocation semaphore for */ 328 inode allocation semaphore for */
331#define EXT4_GET_BLOCKS_DELALLOC_RESERVE 0x0008 329#define EXT4_GET_BLOCKS_DELALLOC_RESERVE 0x0004
332 /* Call ext4_da_update_reserve_space() after successfully 330 /* Call ext4_da_update_reserve_space() after successfully
333 allocating the blocks */ 331 allocating the blocks */
334#define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0010 332#define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008
335 333
336 334
337/* 335/*
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index d4e99e96fddb..9c35a7b1f0ae 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2779,7 +2779,6 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2779 int err = 0, depth, ret, cache_type; 2779 int err = 0, depth, ret, cache_type;
2780 unsigned int allocated = 0; 2780 unsigned int allocated = 0;
2781 struct ext4_allocation_request ar; 2781 struct ext4_allocation_request ar;
2782 loff_t disksize;
2783 2782
2784 __clear_bit(BH_New, &bh_result->b_state); 2783 __clear_bit(BH_New, &bh_result->b_state);
2785 ext_debug("blocks %u/%u requested for inode %u\n", 2784 ext_debug("blocks %u/%u requested for inode %u\n",
@@ -2969,14 +2968,6 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2969 newblock = ext_pblock(&newex); 2968 newblock = ext_pblock(&newex);
2970 allocated = ext4_ext_get_actual_len(&newex); 2969 allocated = ext4_ext_get_actual_len(&newex);
2971outnew: 2970outnew:
2972 if (flags & EXT4_GET_BLOCKS_EXTEND_DISKSIZE) {
2973 disksize = ((loff_t) iblock + ar.len) << inode->i_blkbits;
2974 if (disksize > i_size_read(inode))
2975 disksize = i_size_read(inode);
2976 if (disksize > EXT4_I(inode)->i_disksize)
2977 EXT4_I(inode)->i_disksize = disksize;
2978 }
2979
2980 set_buffer_new(bh_result); 2971 set_buffer_new(bh_result);
2981 2972
2982 /* Cache only when it is _not_ an uninitialized extent */ 2973 /* Cache only when it is _not_ an uninitialized extent */
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 14c00fff3713..17ed0d244dbb 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -933,11 +933,8 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,
933 int indirect_blks; 933 int indirect_blks;
934 int blocks_to_boundary = 0; 934 int blocks_to_boundary = 0;
935 int depth; 935 int depth;
936 struct ext4_inode_info *ei = EXT4_I(inode);
937 int count = 0; 936 int count = 0;
938 ext4_fsblk_t first_block = 0; 937 ext4_fsblk_t first_block = 0;
939 loff_t disksize;
940
941 938
942 J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)); 939 J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL));
943 J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0); 940 J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0);
@@ -1003,19 +1000,7 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,
1003 if (!err) 1000 if (!err)
1004 err = ext4_splice_branch(handle, inode, iblock, 1001 err = ext4_splice_branch(handle, inode, iblock,
1005 partial, indirect_blks, count); 1002 partial, indirect_blks, count);
1006 /* 1003 else
1007 * i_disksize growing is protected by i_data_sem. Don't forget to
1008 * protect it if you're about to implement concurrent
1009 * ext4_get_block() -bzzz
1010 */
1011 if (!err && (flags & EXT4_GET_BLOCKS_EXTEND_DISKSIZE)) {
1012 disksize = ((loff_t) iblock + count) << inode->i_blkbits;
1013 if (disksize > i_size_read(inode))
1014 disksize = i_size_read(inode);
1015 if (disksize > ei->i_disksize)
1016 ei->i_disksize = disksize;
1017 }
1018 if (err)
1019 goto cleanup; 1004 goto cleanup;
1020 1005
1021 set_buffer_new(bh_result); 1006 set_buffer_new(bh_result);
@@ -1321,7 +1306,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
1321{ 1306{
1322 struct buffer_head dummy; 1307 struct buffer_head dummy;
1323 int fatal = 0, err; 1308 int fatal = 0, err;
1324 int flags = EXT4_GET_BLOCKS_EXTEND_DISKSIZE; 1309 int flags = 0;
1325 1310
1326 J_ASSERT(handle != NULL || create == 0); 1311 J_ASSERT(handle != NULL || create == 0);
1327 1312
@@ -2153,9 +2138,7 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd)
2153 } 2138 }
2154 2139
2155 /* 2140 /*
2156 * Update on-disk size along with block allocation we don't 2141 * Update on-disk size along with block allocation.
2157 * use EXT4_GET_BLOCKS_EXTEND_DISKSIZE as size may change
2158 * within already allocated block -bzzz
2159 */ 2142 */
2160 disksize = ((loff_t) next + blks) << mpd->inode->i_blkbits; 2143 disksize = ((loff_t) next + blks) << mpd->inode->i_blkbits;
2161 if (disksize > i_size_read(mpd->inode)) 2144 if (disksize > i_size_read(mpd->inode))