[29/46] btrfs: Make btrfs_run_delalloc_range take btrfs_inode
diff mbox series

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

Commit Message

Nikolay Borisov June 1, 2020, 3:37 p.m. UTC
All children now take btrfs_inode so convert it to taking it as a parameter
as well.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/ctree.h     |  2 +-
 fs/btrfs/extent_io.c |  6 ++++--
 fs/btrfs/inode.c     | 26 +++++++++++++-------------
 3 files changed, 18 insertions(+), 16 deletions(-)

--
2.17.1

Patch
diff mbox series

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index bd69e912e8d6..e6f47bdf6f0a 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2927,7 +2927,7 @@  int btrfs_prealloc_file_range_trans(struct inode *inode,
 				    struct btrfs_trans_handle *trans, int mode,
 				    u64 start, u64 num_bytes, u64 min_size,
 				    loff_t actual_len, u64 *alloc_hint);
-int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page,
+int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page,
 		u64 start, u64 end, int *page_started, unsigned long *nr_written,
 		struct writeback_control *wbc);
 int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 4d19cb930d57..e2a033e77b25 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3444,8 +3444,10 @@  static noinline_for_stack int writepage_delalloc(struct inode *inode,
 			delalloc_start = delalloc_end + 1;
 			continue;
 		}
-		ret = btrfs_run_delalloc_range(inode, page, delalloc_start,
-				delalloc_end, &page_started, nr_written, wbc);
+		ret = btrfs_run_delalloc_range(BTRFS_I(inode), page,
+					       delalloc_start,
+					       delalloc_end, &page_started,
+					       nr_written, wbc);
 		if (ret) {
 			SetPageError(page);
 			/*
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 709253e2470a..54e291c94214 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1795,31 +1795,31 @@  static inline int need_force_cow(struct btrfs_inode *inode, u64 start, u64 end)
  * Function to process delayed allocation (create CoW) for ranges which are
  * being touched for the first time.
  */
-int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page,
+int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page,
 		u64 start, u64 end, int *page_started, unsigned long *nr_written,
 		struct writeback_control *wbc)
 {
 	int ret;
-	int force_cow = need_force_cow(BTRFS_I(inode), start, end);
+	int force_cow = need_force_cow(inode, start, end);

-	if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW && !force_cow) {
-		ret = run_delalloc_nocow(BTRFS_I(inode), locked_page, start, end,
+	if (inode->flags & BTRFS_INODE_NODATACOW && !force_cow) {
+		ret = run_delalloc_nocow(inode, locked_page, start, end,
 					 page_started, 1, nr_written);
-	} else if (BTRFS_I(inode)->flags & BTRFS_INODE_PREALLOC && !force_cow) {
-		ret = run_delalloc_nocow(BTRFS_I(inode), locked_page, start, end,
+	} else if (inode->flags & BTRFS_INODE_PREALLOC && !force_cow) {
+		ret = run_delalloc_nocow(inode, locked_page, start, end,
 					 page_started, 0, nr_written);
-	} else if (!inode_can_compress(BTRFS_I(inode)) ||
-		   !inode_need_compress(BTRFS_I(inode), start, end)) {
-		ret = cow_file_range(BTRFS_I(inode), locked_page, start, end,
-				      page_started, nr_written, 1);
+	} else if (!inode_can_compress(inode) ||
+		   !inode_need_compress(inode, start, end)) {
+		ret = cow_file_range(inode, locked_page, start, end,
+				     page_started, nr_written, 1);
 	} else {
 		set_bit(BTRFS_INODE_HAS_ASYNC_EXTENT,
-			&BTRFS_I(inode)->runtime_flags);
-		ret = cow_file_range_async(BTRFS_I(inode), wbc, locked_page, start, end,
+			&inode->runtime_flags);
+		ret = cow_file_range_async(inode, wbc, locked_page, start, end,
 					   page_started, nr_written);
 	}
 	if (ret)
-		btrfs_cleanup_ordered_extents(BTRFS_I(inode), locked_page, start,
+		btrfs_cleanup_ordered_extents(inode, locked_page, start,
 					      end - start + 1);
 	return ret;
 }