All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 10/12] btrfs: Make copy_inline_to_page take btrfs_inode
Date: Mon, 31 Aug 2020 14:42:47 +0300	[thread overview]
Message-ID: <20200831114249.8360-11-nborisov@suse.com> (raw)
In-Reply-To: <20200831114249.8360-1-nborisov@suse.com>

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

diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index 7126f94cf216..2461be6ccb6f 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -45,19 +45,20 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
 	return ret;
 }
 
-static int copy_inline_to_page(struct inode *inode,
+static int copy_inline_to_page(struct btrfs_inode *inode,
 			       const u64 file_offset,
 			       char *inline_data,
 			       const u64 size,
 			       const u64 datal,
 			       const u8 comp_type)
 {
-	const u64 block_size = btrfs_inode_sectorsize(BTRFS_I(inode));
+	const u64 block_size = btrfs_inode_sectorsize(inode);
 	const u64 range_end = file_offset + block_size - 1;
 	const size_t inline_size = size - btrfs_file_extent_calc_inline_size(0);
 	char *data_start = inline_data + btrfs_file_extent_calc_inline_size(0);
 	struct extent_changeset *data_reserved = NULL;
 	struct page *page = NULL;
+	struct address_space *mapping = inode->vfs_inode.i_mapping;
 	int ret;
 
 	ASSERT(IS_ALIGNED(file_offset, block_size));
@@ -68,24 +69,23 @@ static int copy_inline_to_page(struct inode *inode,
 	 * reservation here. Also we must not do the reservation while holding
 	 * a transaction open, otherwise we would deadlock.
 	 */
-	ret = btrfs_delalloc_reserve_space(BTRFS_I(inode), &data_reserved,
-					   file_offset, block_size);
+	ret = btrfs_delalloc_reserve_space(inode, &data_reserved, file_offset,
+					   block_size);
 	if (ret)
 		goto out;
 
-	page = find_or_create_page(inode->i_mapping, file_offset >> PAGE_SHIFT,
-				   btrfs_alloc_write_mask(inode->i_mapping));
+	page = find_or_create_page(mapping, file_offset >> PAGE_SHIFT,
+				   btrfs_alloc_write_mask(mapping));
 	if (!page) {
 		ret = -ENOMEM;
 		goto out_unlock;
 	}
 
 	set_page_extent_mapped(page);
-	clear_extent_bit(&BTRFS_I(inode)->io_tree, file_offset, range_end,
+	clear_extent_bit(&inode->io_tree, file_offset, range_end,
 			 EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
 			 0, 0, NULL);
-	ret = btrfs_set_extent_delalloc(BTRFS_I(inode), file_offset, range_end,
-					0, NULL);
+	ret = btrfs_set_extent_delalloc(inode, file_offset, range_end, 0, NULL);
 	if (ret)
 		goto out_unlock;
 
@@ -134,9 +134,9 @@ static int copy_inline_to_page(struct inode *inode,
 		put_page(page);
 	}
 	if (ret)
-		btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved,
-					     file_offset, block_size, true);
-	btrfs_delalloc_release_extents(BTRFS_I(inode), block_size);
+		btrfs_delalloc_release_space(inode, data_reserved, file_offset,
+					     block_size, true);
+	btrfs_delalloc_release_extents(inode, block_size);
 out:
 	extent_changeset_free(data_reserved);
 
@@ -167,8 +167,8 @@ static int clone_copy_inline_extent(struct inode *dst,
 	struct btrfs_key key;
 
 	if (new_key->offset > 0) {
-		ret = copy_inline_to_page(dst, new_key->offset, inline_data,
-					  size, datal, comp_type);
+		ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
+					  inline_data, size, datal, comp_type);
 		goto out;
 	}
 
@@ -194,7 +194,7 @@ static int clone_copy_inline_extent(struct inode *dst,
 			 * inline extent's data to the page.
 			 */
 			ASSERT(key.offset > 0);
-			ret = copy_inline_to_page(dst, new_key->offset,
+			ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
 						  inline_data, size, datal,
 						  comp_type);
 			goto out;
@@ -213,8 +213,8 @@ static int clone_copy_inline_extent(struct inode *dst,
 		    BTRFS_FILE_EXTENT_INLINE)
 			goto copy_inline_extent;
 
-		ret = copy_inline_to_page(dst, new_key->offset, inline_data,
-					  size, datal, comp_type);
+		ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
+					  inline_data, size, datal, comp_type);
 		goto out;
 	}
 
@@ -231,8 +231,8 @@ static int clone_copy_inline_extent(struct inode *dst,
 		 * clone. Deal with all these cases by copying the inline extent
 		 * data into the respective page at the destination inode.
 		 */
-		ret = copy_inline_to_page(dst, new_key->offset, inline_data,
-					   size, datal, comp_type);
+		ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
+					  inline_data, size, datal, comp_type);
 		goto out;
 	}
 
-- 
2.17.1


  parent reply	other threads:[~2020-08-31 11:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 11:42 [PATCH 00/12] Another batch of inode vs btrfs_inode cleanups Nikolay Borisov
2020-08-31 11:42 ` [PATCH 01/12] btrfs: Make inode_tree_del take btrfs_inode Nikolay Borisov
2020-08-31 12:03   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 02/12] btrfs: Make btrfs_lookup_first_ordered_extent " Nikolay Borisov
2020-08-31 12:09   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 03/12] btrfs: Make ordered extent tracepoint " Nikolay Borisov
2020-08-31 12:14   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 04/12] btrfs: Make btrfs_dec_test_ordered_pending " Nikolay Borisov
2020-08-31 12:19   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 05/12] btrfs: Convert btrfs_inode_sectorsize to " Nikolay Borisov
2020-08-31 12:20   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 06/12] btrfs: Make btrfs_invalidatepage work on btrfs_inode Nikolay Borisov
2020-08-31 13:24   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 07/12] btrfs: Make btrfs_writepage_endio_finish_ordered btrfs_inode-centric Nikolay Borisov
2020-08-31 12:23   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 08/12] btrfs: Make get_extent_skip_holes take btrfs_inode Nikolay Borisov
2020-08-31 12:26   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 09/12] btrfs: Make btrfs_find_ordered_sum " Nikolay Borisov
2020-08-31 13:14   ` Johannes Thumshirn
2020-08-31 11:42 ` Nikolay Borisov [this message]
2020-08-31 13:18   ` [PATCH 10/12] btrfs: Make copy_inline_to_page " Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 11/12] btrfs: Make btrfs_zero_range_check_range_boundary " Nikolay Borisov
2020-08-31 13:20   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 12/12] btrfs: Make extent_fiemap take btrfs_iode Nikolay Borisov
2020-08-31 13:21   ` Johannes Thumshirn
2020-08-31 15:43 ` [PATCH 00/12] Another batch of inode vs btrfs_inode cleanups Josef Bacik
2020-09-01 14:13 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200831114249.8360-11-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.