[20/46] btrfs: Make fallback_to_cow take btrfs_inode
diff mbox series

Message ID 20200603055546.3889-21-nborisov@suse.com
State New
Headers show
Series
  • Trivial BTRFS_I removal
Related show

Commit Message

Nikolay Borisov June 3, 2020, 5:55 a.m. UTC
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>
---
 fs/btrfs/inode.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

--
2.17.1

Patch
diff mbox series

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2f6460241c61..27051e8a7013 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1352,13 +1352,13 @@  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_space_ino = btrfs_is_free_space_inode(inode);
 	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;

@@ -1396,7 +1396,7 @@  static int fallback_to_cow(struct inode *inode, struct page *locked_page,
 				 EXTENT_NORESERVE, 0);
 	if (count > 0 || is_space_ino) {
 		const u64 bytes = is_space_ino ? range_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;

 		spin_lock(&sinfo->lock);
@@ -1408,8 +1408,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);
 }

 /*
@@ -1660,8 +1660,8 @@  static noinline int run_delalloc_nocow(struct inode *inode,
 		 * 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) {
 				if (nocow)
@@ -1751,8 +1751,8 @@  static noinline int run_delalloc_nocow(struct inode *inode,

 	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;
 	}