Skip to content

Commit

Permalink
btrfs: make btrfs_zero_range_check_range_boundary take btrfs_inode
Browse files Browse the repository at this point in the history
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Nikolay Borisov authored and David Sterba committed Oct 7, 2020
1 parent 998acfe commit 948dfeb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3105,15 +3105,15 @@ enum {
RANGE_BOUNDARY_HOLE,
};

static int btrfs_zero_range_check_range_boundary(struct inode *inode,
static int btrfs_zero_range_check_range_boundary(struct btrfs_inode *inode,
u64 offset)
{
const u64 sectorsize = btrfs_inode_sectorsize(BTRFS_I(inode));
const u64 sectorsize = btrfs_inode_sectorsize(inode);
struct extent_map *em;
int ret;

offset = round_down(offset, sectorsize);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize);
if (IS_ERR(em))
return PTR_ERR(em);

Expand Down Expand Up @@ -3228,7 +3228,8 @@ static int btrfs_zero_range(struct inode *inode,
* to cover them.
*/
if (!IS_ALIGNED(offset, sectorsize)) {
ret = btrfs_zero_range_check_range_boundary(inode, offset);
ret = btrfs_zero_range_check_range_boundary(BTRFS_I(inode),
offset);
if (ret < 0)
goto out;
if (ret == RANGE_BOUNDARY_HOLE) {
Expand All @@ -3244,7 +3245,7 @@ static int btrfs_zero_range(struct inode *inode,
}

if (!IS_ALIGNED(offset + len, sectorsize)) {
ret = btrfs_zero_range_check_range_boundary(inode,
ret = btrfs_zero_range_check_range_boundary(BTRFS_I(inode),
offset + len);
if (ret < 0)
goto out;
Expand Down

0 comments on commit 948dfeb

Please sign in to comment.