diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-12-03 17:18:14 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-01-07 14:18:24 +0100 |
commit | 487e81d2a4009d17dcfe7c67b78b75cd96bcdde3 (patch) | |
tree | 5dd90cbdf77a8de1667fd13e37c0859e20759c2c /fs/btrfs/inode-item.c | |
parent | 655807b8957ba84a583104c422a8f53725997d55 (diff) |
btrfs: pass the ino via truncate control
In the future we are going to want to truncate inode items without
needing to have an btrfs_inode to pass in, so add ino to the
btrfs_truncate_control and use that to look up the inode items to
truncate.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode-item.c')
-rw-r--r-- | fs/btrfs/inode-item.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index 5598090bd0aa..a24ed49daa4e 100644 --- a/fs/btrfs/inode-item.c +++ b/fs/btrfs/inode-item.c @@ -458,7 +458,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, int pending_del_slot = 0; int extent_type = -1; int ret; - u64 ino = btrfs_ino(inode); u64 bytes_deleted = 0; bool be_nice = false; bool should_throttle = false; @@ -480,7 +479,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, return -ENOMEM; path->reada = READA_BACK; - key.objectid = ino; + key.objectid = control->ino; key.offset = (u64)-1; key.type = (u8)-1; @@ -516,7 +515,7 @@ search_again: btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); found_type = found_key.type; - if (found_key.objectid != ino) + if (found_key.objectid != control->ino) break; if (found_type < control->min_type) @@ -667,7 +666,7 @@ delete: btrfs_init_generic_ref(&ref, BTRFS_DROP_DELAYED_REF, extent_start, extent_num_bytes, 0); btrfs_init_data_ref(&ref, btrfs_header_owner(leaf), - ino, extent_offset, + control->ino, extent_offset, root->root_key.objectid, false); ret = btrfs_free_extent(trans, &ref); if (ret) { |