From 5caa490ed8f07488e47378999bd4ad451bf8858b Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 3 Dec 2021 17:18:12 -0500 Subject: btrfs: control extent reference updates with a control flag for truncate We've had weird bugs in the past where we forgot to adjust the truncate path to deal with the fact that we can be called by the tree log path. Instead of checking if our root is a LOG_ROOT use a flag on the btrfs_truncate_control to indicate that we don't want to do extent reference updates during this truncate. Reviewed-by: Filipe Manana Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/inode-item.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/btrfs/inode-item.c') 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; -- cgit v1.2.3