[PATCH 11/12] btrfs: Make btrfs_zero_range_check_range_boundary take btrfs_inode

Nikolay Borisov
2020-08-31T11:54:00Z

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/file.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 09f21ea64ecb..2cacb4424cd4 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -3072,15 +3072,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);

@@ -3195,7 +3195,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) {
@@ -3211,7 +3212,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;
--
2.17.1