[PATCH v2] ext4: Update i_disksize properly when allocating from fallocate area.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When allocating blocks from an falloc area which was initialized with
FALLOC_FL_KEEP_SIZE we need to extent disksize.

These changes are for code correctness. We do update the i_disksize
in the write_end callback of filesystem properly.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
---
 fs/ext4/extents.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 27cfd30..362211c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2885,7 +2885,10 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
 					ext4_ext_get_actual_len(&newex), 0);
 		goto out2;
 	}
-
+	/* previous routine could use block we allocated */
+	newblock = ext_pblock(&newex);
+	allocated = ext4_ext_get_actual_len(&newex);
+outnew:
 	if (extend_disksize) {
 		disksize = ((loff_t) iblock + ar.len) << inode->i_blkbits;
 		if (disksize > i_size_read(inode))
@@ -2893,11 +2896,6 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
 		if (disksize > EXT4_I(inode)->i_disksize)
 			EXT4_I(inode)->i_disksize = disksize;
 	}
-
-	/* previous routine could use block we allocated */
-	newblock = ext_pblock(&newex);
-	allocated = ext4_ext_get_actual_len(&newex);
-outnew:
 	__set_bit(BH_New, &bh_result->b_state);
 
 	/* Cache only when it is _not_ an uninitialized extent */
-- 
1.5.6.rc2.15.g457bb.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux