diff options
author | Nikolay Borisov <nborisov@suse.com> | 2020-11-02 16:49:00 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-12-08 15:54:11 +0100 |
commit | a4ba6cc03eba9d6a64cb72bb487a97ef26a7d620 (patch) | |
tree | 6e9476e56e2fbc30f3068f8d210a9e8a5f3c9c85 /fs/btrfs | |
parent | 9a56fcd15a9c6b580a21c439deab60bb4cd2cfd9 (diff) |
btrfs: make maybe_insert_hole take btrfs_inode
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ed0249bdaf46..732a5fab471d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4792,10 +4792,10 @@ out: return ret; } -static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode, +static int maybe_insert_hole(struct btrfs_root *root, struct btrfs_inode *inode, u64 offset, u64 len) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); + struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_trans_handle *trans; struct btrfs_drop_extents_args drop_args = { 0 }; int ret; @@ -4805,9 +4805,9 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode, * that any holes get logged if we fsync. */ if (btrfs_fs_incompat(fs_info, NO_HOLES)) { - BTRFS_I(inode)->last_trans = fs_info->generation; - BTRFS_I(inode)->last_sub_trans = root->log_transid; - BTRFS_I(inode)->last_log_commit = root->last_log_commit; + inode->last_trans = fs_info->generation; + inode->last_sub_trans = root->log_transid; + inode->last_log_commit = root->last_log_commit; return 0; } @@ -4824,20 +4824,20 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode, drop_args.end = offset + len; drop_args.drop_cache = true; - ret = btrfs_drop_extents(trans, root, BTRFS_I(inode), &drop_args); + ret = btrfs_drop_extents(trans, root, inode, &drop_args); if (ret) { btrfs_abort_transaction(trans, ret); btrfs_end_transaction(trans); return ret; } - ret = btrfs_insert_file_extent(trans, root, btrfs_ino(BTRFS_I(inode)), + ret = btrfs_insert_file_extent(trans, root, btrfs_ino(inode), offset, 0, 0, len, 0, len, 0, 0, 0); if (ret) { btrfs_abort_transaction(trans, ret); } else { - btrfs_update_inode_bytes(BTRFS_I(inode), 0, drop_args.bytes_found); - btrfs_update_inode(trans, root, BTRFS_I(inode)); + btrfs_update_inode_bytes(inode, 0, drop_args.bytes_found); + btrfs_update_inode(trans, root, inode); } btrfs_end_transaction(trans); return ret; @@ -4894,8 +4894,8 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { struct extent_map *hole_em; - err = maybe_insert_hole(root, inode, cur_offset, - hole_size); + err = maybe_insert_hole(root, BTRFS_I(inode), + cur_offset, hole_size); if (err) break; |