diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/extents.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index b2d3869b5762..f24ef8697609 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -5229,11 +5229,11 @@ ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift, | |||
5229 | if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr)) | 5229 | if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr)) |
5230 | update = 1; | 5230 | update = 1; |
5231 | 5231 | ||
5232 | *start = ex_last->ee_block + | 5232 | *start = le32_to_cpu(ex_last->ee_block) + |
5233 | ext4_ext_get_actual_len(ex_last); | 5233 | ext4_ext_get_actual_len(ex_last); |
5234 | 5234 | ||
5235 | while (ex_start <= ex_last) { | 5235 | while (ex_start <= ex_last) { |
5236 | ex_start->ee_block -= shift; | 5236 | le32_add_cpu(&ex_start->ee_block, -shift); |
5237 | if (ex_start > | 5237 | if (ex_start > |
5238 | EXT_FIRST_EXTENT(path[depth].p_hdr)) { | 5238 | EXT_FIRST_EXTENT(path[depth].p_hdr)) { |
5239 | if (ext4_ext_try_to_merge_right(inode, | 5239 | if (ext4_ext_try_to_merge_right(inode, |
@@ -5255,7 +5255,7 @@ ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift, | |||
5255 | if (err) | 5255 | if (err) |
5256 | goto out; | 5256 | goto out; |
5257 | 5257 | ||
5258 | path[depth].p_idx->ei_block -= shift; | 5258 | le32_add_cpu(&path[depth].p_idx->ei_block, -shift); |
5259 | err = ext4_ext_dirty(handle, inode, path + depth); | 5259 | err = ext4_ext_dirty(handle, inode, path + depth); |
5260 | if (err) | 5260 | if (err) |
5261 | goto out; | 5261 | goto out; |
@@ -5300,7 +5300,8 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle, | |||
5300 | return ret; | 5300 | return ret; |
5301 | } | 5301 | } |
5302 | 5302 | ||
5303 | stop_block = extent->ee_block + ext4_ext_get_actual_len(extent); | 5303 | stop_block = le32_to_cpu(extent->ee_block) + |
5304 | ext4_ext_get_actual_len(extent); | ||
5304 | ext4_ext_drop_refs(path); | 5305 | ext4_ext_drop_refs(path); |
5305 | kfree(path); | 5306 | kfree(path); |
5306 | 5307 | ||
@@ -5315,8 +5316,9 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle, | |||
5315 | path = ext4_ext_find_extent(inode, start - 1, NULL, 0); | 5316 | path = ext4_ext_find_extent(inode, start - 1, NULL, 0); |
5316 | depth = path->p_depth; | 5317 | depth = path->p_depth; |
5317 | extent = path[depth].p_ext; | 5318 | extent = path[depth].p_ext; |
5318 | ex_start = extent->ee_block; | 5319 | ex_start = le32_to_cpu(extent->ee_block); |
5319 | ex_end = extent->ee_block + ext4_ext_get_actual_len(extent); | 5320 | ex_end = le32_to_cpu(extent->ee_block) + |
5321 | ext4_ext_get_actual_len(extent); | ||
5320 | ext4_ext_drop_refs(path); | 5322 | ext4_ext_drop_refs(path); |
5321 | kfree(path); | 5323 | kfree(path); |
5322 | 5324 | ||
@@ -5331,7 +5333,7 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle, | |||
5331 | return PTR_ERR(path); | 5333 | return PTR_ERR(path); |
5332 | depth = path->p_depth; | 5334 | depth = path->p_depth; |
5333 | extent = path[depth].p_ext; | 5335 | extent = path[depth].p_ext; |
5334 | current_block = extent->ee_block; | 5336 | current_block = le32_to_cpu(extent->ee_block); |
5335 | if (start > current_block) { | 5337 | if (start > current_block) { |
5336 | /* Hole, move to the next extent */ | 5338 | /* Hole, move to the next extent */ |
5337 | ret = mext_next_extent(inode, path, &extent); | 5339 | ret = mext_next_extent(inode, path, &extent); |