ext4: Include forgotten start block on fallocate insert range
am: 3daefdae5f
Change-Id: I96ed2bfb756e3a37c07656d632660757c100065b
This commit is contained in:
commit
9c0e44491b
1 changed files with 12 additions and 6 deletions
|
@ -5371,8 +5371,7 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
|
|||
if (!extent)
|
||||
goto out;
|
||||
|
||||
stop = le32_to_cpu(extent->ee_block) +
|
||||
ext4_ext_get_actual_len(extent);
|
||||
stop = le32_to_cpu(extent->ee_block);
|
||||
|
||||
/*
|
||||
* In case of left shift, Don't start shifting extents until we make
|
||||
|
@ -5411,8 +5410,12 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
|
|||
else
|
||||
iterator = &stop;
|
||||
|
||||
/* Its safe to start updating extents */
|
||||
while (start < stop) {
|
||||
/*
|
||||
* Its safe to start updating extents. Start and stop are unsigned, so
|
||||
* in case of right shift if extent with 0 block is reached, iterator
|
||||
* becomes NULL to indicate the end of the loop.
|
||||
*/
|
||||
while (iterator && start <= stop) {
|
||||
path = ext4_find_extent(inode, *iterator, &path, 0);
|
||||
if (IS_ERR(path))
|
||||
return PTR_ERR(path);
|
||||
|
@ -5440,8 +5443,11 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
|
|||
ext4_ext_get_actual_len(extent);
|
||||
} else {
|
||||
extent = EXT_FIRST_EXTENT(path[depth].p_hdr);
|
||||
*iterator = le32_to_cpu(extent->ee_block) > 0 ?
|
||||
le32_to_cpu(extent->ee_block) - 1 : 0;
|
||||
if (le32_to_cpu(extent->ee_block) > 0)
|
||||
*iterator = le32_to_cpu(extent->ee_block) - 1;
|
||||
else
|
||||
/* Beginning is reached, end of the loop */
|
||||
iterator = NULL;
|
||||
/* Update path extent in case we need to stop */
|
||||
while (le32_to_cpu(extent->ee_block) < start)
|
||||
extent++;
|
||||
|
|
Loading…
Add table
Reference in a new issue