]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: make fallback_to_cow take btrfs_inode
authorNikolay Borisov <nborisov@suse.com>
Wed, 3 Jun 2020 05:55:20 +0000 (08:55 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 27 Jul 2020 10:55:32 +0000 (12:55 +0200)
It really wants btrfs_inode and is prepration to converting
run_delalloc_nocow to taking btrfs_inode.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index f3b711e39dbeb1d9203878f18aed27478deb8a8e..329b5ad7fe59e42941ebd07fcf3c7e04dd0d4064 100644 (file)
@@ -1370,15 +1370,15 @@ static noinline int csum_exist_in_range(struct btrfs_fs_info *fs_info,
        return 1;
 }
 
-static int fallback_to_cow(struct inode *inode, struct page *locked_page,
+static int fallback_to_cow(struct btrfs_inode *inode, struct page *locked_page,
                           const u64 start, const u64 end,
                           int *page_started, unsigned long *nr_written)
 {
-       const bool is_space_ino = btrfs_is_free_space_inode(BTRFS_I(inode));
-       const bool is_reloc_ino = (BTRFS_I(inode)->root->root_key.objectid ==
+       const bool is_space_ino = btrfs_is_free_space_inode(inode);
+       const bool is_reloc_ino = (inode->root->root_key.objectid ==
                                   BTRFS_DATA_RELOC_TREE_OBJECTID);
        const u64 range_bytes = end + 1 - start;
-       struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
+       struct extent_io_tree *io_tree = &inode->io_tree;
        u64 range_start = start;
        u64 count;
 
@@ -1418,7 +1418,7 @@ static int fallback_to_cow(struct inode *inode, struct page *locked_page,
                                 EXTENT_NORESERVE, 0);
        if (count > 0 || is_space_ino || is_reloc_ino) {
                u64 bytes = count;
-               struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
+               struct btrfs_fs_info *fs_info = inode->root->fs_info;
                struct btrfs_space_info *sinfo = fs_info->data_sinfo;
 
                if (is_space_ino || is_reloc_ino)
@@ -1433,8 +1433,8 @@ static int fallback_to_cow(struct inode *inode, struct page *locked_page,
                                         0, 0, NULL);
        }
 
-       return cow_file_range(BTRFS_I(inode), locked_page, start, end,
-                             page_started, nr_written, 1);
+       return cow_file_range(inode, locked_page, start, end, page_started,
+                             nr_written, 1);
 }
 
 /*
@@ -1685,8 +1685,8 @@ out_check:
                 * NOCOW, following one which needs to be COW'ed
                 */
                if (cow_start != (u64)-1) {
-                       ret = fallback_to_cow(inode, locked_page, cow_start,
-                                             found_key.offset - 1,
+                       ret = fallback_to_cow(BTRFS_I(inode), locked_page,
+                                             cow_start, found_key.offset - 1,
                                              page_started, nr_written);
                        if (ret)
                                goto error;
@@ -1769,8 +1769,8 @@ out_check:
 
        if (cow_start != (u64)-1) {
                cur_offset = end;
-               ret = fallback_to_cow(inode, locked_page, cow_start, end,
-                                     page_started, nr_written);
+               ret = fallback_to_cow(BTRFS_I(inode), locked_page, cow_start,
+                                     end, page_started, nr_written);
                if (ret)
                        goto error;
        }