summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode-item.c3
-rw-r--r--fs/btrfs/inode-item.h6
-rw-r--r--fs/btrfs/tree-log.c1
3 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index 278d579f50bd..4c753415ab06 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -659,8 +659,7 @@ delete:
}
should_throttle = false;
- if (del_item && extent_start != 0 &&
- root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
+ if (del_item && extent_start != 0 && !control->skip_ref_updates) {
struct btrfs_ref ref = { 0 };
bytes_deleted += extent_num_bytes;
diff --git a/fs/btrfs/inode-item.h b/fs/btrfs/inode-item.h
index 7b5b455262cb..1f31bb407f4a 100644
--- a/fs/btrfs/inode-item.h
+++ b/fs/btrfs/inode-item.h
@@ -37,6 +37,12 @@ struct btrfs_truncate_control {
* removed only if their offset >= new_size.
*/
u32 min_type;
+
+ /*
+ * IN: true if we don't want to do extent reference updates for any file
+ * extents we drop.
+ */
+ bool skip_ref_updates;
};
int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index c732a429a1c6..2b5e24c24a6b 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4101,6 +4101,7 @@ static int truncate_inode_items(struct btrfs_trans_handle *trans,
struct btrfs_truncate_control control = {
.new_size = new_size,
.min_type = min_type,
+ .skip_ref_updates = true,
};
int ret;