summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-12-04 01:18:15 +0300
committerDavid Sterba <dsterba@suse.com>2022-01-07 16:18:24 +0300
commit71d18b53540f106a394cb35ed93b487b76678b06 (patch)
treee2d9a6c7862dd055a160c8e76e45776d8526dc95 /fs/btrfs/inode.c
parent487e81d2a4009d17dcfe7c67b78b75cd96bcdde3 (diff)
downloadlinux-71d18b53540f106a394cb35ed93b487b76678b06.tar.xz
btrfs: add inode to truncate control
In the future we're going to want to use btrfs_truncate_inode_items without looking up the associated inode. In order to accommodate this add the inode to btrfs_truncate_control and handle the case where control->inode is NULL appropriately. This is fairly straightforward, we simply need to add a helper for the trace points, as the file extent map update is controlled by a flag on btrfs_truncate_control. 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.c')
-rw-r--r--fs/btrfs/inode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ea1223c53a10..a88130c7782e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5252,6 +5252,7 @@ void btrfs_evict_inode(struct inode *inode)
while (1) {
struct btrfs_truncate_control control = {
+ .inode = BTRFS_I(inode),
.ino = btrfs_ino(BTRFS_I(inode)),
.new_size = 0,
.min_type = 0,
@@ -5263,8 +5264,7 @@ void btrfs_evict_inode(struct inode *inode)
trans->block_rsv = rsv;
- ret = btrfs_truncate_inode_items(trans, root, BTRFS_I(inode),
- &control);
+ ret = btrfs_truncate_inode_items(trans, root, &control);
trans->block_rsv = &fs_info->trans_block_rsv;
btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info);
@@ -8534,6 +8534,7 @@ out_noreserve:
static int btrfs_truncate(struct inode *inode, bool skip_writeback)
{
struct btrfs_truncate_control control = {
+ .inode = BTRFS_I(inode),
.ino = btrfs_ino(BTRFS_I(inode)),
.min_type = BTRFS_EXTENT_DATA_KEY,
.clear_extent_range = true,
@@ -8621,8 +8622,7 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)
ALIGN(new_size, fs_info->sectorsize),
(u64)-1, 0);
- ret = btrfs_truncate_inode_items(trans, root, BTRFS_I(inode),
- &control);
+ ret = btrfs_truncate_inode_items(trans, root, &control);
inode_sub_bytes(inode, control.sub_bytes);
btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), control.last_size);