|
@@ -4418,19 +4418,8 @@ search_again:
|
|
|
if (found_type > min_type) {
|
|
|
del_item = 1;
|
|
|
} else {
|
|
|
- if (item_end < new_size) {
|
|
|
- /*
|
|
|
- * With NO_HOLES mode, for the following mapping
|
|
|
- *
|
|
|
- * [0-4k][hole][8k-12k]
|
|
|
- *
|
|
|
- * if truncating isize down to 6k, it ends up
|
|
|
- * isize being 8k.
|
|
|
- */
|
|
|
- if (btrfs_fs_incompat(root->fs_info, NO_HOLES))
|
|
|
- last_size = new_size;
|
|
|
+ if (item_end < new_size)
|
|
|
break;
|
|
|
- }
|
|
|
if (found_key.offset >= new_size)
|
|
|
del_item = 1;
|
|
|
else
|
|
@@ -4613,8 +4602,12 @@ out:
|
|
|
btrfs_abort_transaction(trans, ret);
|
|
|
}
|
|
|
error:
|
|
|
- if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID)
|
|
|
+ if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
|
|
|
+ ASSERT(last_size >= new_size);
|
|
|
+ if (!err && last_size > new_size)
|
|
|
+ last_size = new_size;
|
|
|
btrfs_ordered_update_i_size(inode, last_size, NULL);
|
|
|
+ }
|
|
|
|
|
|
btrfs_free_path(path);
|
|
|
|