From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 04/14] btrfs: Make btrfs_finish_ordered_io btrfs_inode-centric
Date: Mon, 2 Nov 2020 16:48:56 +0200 [thread overview]
Message-ID: <20201102144906.3767963-5-nborisov@suse.com> (raw)
In-Reply-To: <20201102144906.3767963-1-nborisov@suse.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/inode.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 4ec4e59ddb47..5bcac6f27cf9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2561,11 +2561,11 @@ static int insert_ordered_extent_file_extent(struct btrfs_trans_handle *trans,
*/
static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
{
- struct inode *inode = ordered_extent->inode;
- struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
- struct btrfs_root *root = BTRFS_I(inode)->root;
+ struct btrfs_inode *inode = BTRFS_I(ordered_extent->inode);
+ struct btrfs_root *root = inode->root;
+ struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_trans_handle *trans = NULL;
- struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
+ struct extent_io_tree *io_tree = &inode->io_tree;
struct extent_state *cached_state = NULL;
u64 start, end;
int compress_type = 0;
@@ -2586,14 +2586,14 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
!test_bit(BTRFS_ORDERED_DIRECT, &ordered_extent->flags))
clear_new_delalloc_bytes = true;
- freespace_inode = btrfs_is_free_space_inode(BTRFS_I(inode));
+ freespace_inode = btrfs_is_free_space_inode(inode);
if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) {
ret = -EIO;
goto out;
}
- btrfs_free_io_failure_record(BTRFS_I(inode), start, end);
+ btrfs_free_io_failure_record(inode, start, end);
if (test_bit(BTRFS_ORDERED_TRUNCATED, &ordered_extent->flags)) {
truncated = true;
@@ -2606,7 +2606,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) {
BUG_ON(!list_empty(&ordered_extent->list)); /* Logic error */
- btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0);
+ btrfs_inode_safe_disk_i_size_write(inode, 0);
if (freespace_inode)
trans = btrfs_join_transaction_spacecache(root);
else
@@ -2616,8 +2616,8 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
trans = NULL;
goto out;
}
- trans->block_rsv = &BTRFS_I(inode)->block_rsv;
- ret = btrfs_update_inode_fallback(trans, root, inode);
+ trans->block_rsv = &inode->block_rsv;
+ ret = btrfs_update_inode_fallback(trans, root, &inode->vfs_inode);
if (ret) /* -ENOMEM or corruption */
btrfs_abort_transaction(trans, ret);
goto out;
@@ -2636,13 +2636,13 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
goto out;
}
- trans->block_rsv = &BTRFS_I(inode)->block_rsv;
+ trans->block_rsv = &inode->block_rsv;
if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags))
compress_type = ordered_extent->compress_type;
if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) {
BUG_ON(compress_type);
- ret = btrfs_mark_extent_written(trans, BTRFS_I(inode),
+ ret = btrfs_mark_extent_written(trans, inode,
ordered_extent->file_offset,
ordered_extent->file_offset +
logical_len);
@@ -2656,8 +2656,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
ordered_extent->disk_num_bytes);
}
}
- unpin_extent_cache(&BTRFS_I(inode)->extent_tree,
- ordered_extent->file_offset,
+ unpin_extent_cache(&inode->extent_tree, ordered_extent->file_offset,
ordered_extent->num_bytes, trans->transid);
if (ret < 0) {
btrfs_abort_transaction(trans, ret);
@@ -2670,8 +2669,8 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
goto out;
}
- btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), 0);
- ret = btrfs_update_inode_fallback(trans, root, inode);
+ btrfs_inode_safe_disk_i_size_write(inode, 0);
+ ret = btrfs_update_inode_fallback(trans, root, &inode->vfs_inode);
if (ret) { /* -ENOMEM or corruption */
btrfs_abort_transaction(trans, ret);
goto out;
@@ -2683,7 +2682,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
clear_bits |= EXTENT_LOCKED;
if (clear_new_delalloc_bytes)
clear_bits |= EXTENT_DELALLOC_NEW;
- clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, clear_bits,
+ clear_extent_bit(&inode->io_tree, start, end, clear_bits,
(clear_bits & EXTENT_LOCKED) ? 1 : 0, 0,
&cached_state);
@@ -2698,7 +2697,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
clear_extent_uptodate(io_tree, unwritten_start, end, NULL);
/* Drop the cache for the part of the extent we didn't write. */
- btrfs_drop_extent_cache(BTRFS_I(inode), unwritten_start, end, 0);
+ btrfs_drop_extent_cache(inode, unwritten_start, end, 0);
/*
* If the ordered extent had an IOERR or something else went
@@ -2733,7 +2732,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
* This needs to be done to make sure anybody waiting knows we are done
* updating everything for this ordered extent.
*/
- btrfs_remove_ordered_extent(BTRFS_I(inode), ordered_extent);
+ btrfs_remove_ordered_extent(inode, ordered_extent);
/* once for us */
btrfs_put_ordered_extent(ordered_extent);
@@ -4296,7 +4295,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
if (test_bit(BTRFS_ROOT_SHAREABLE,
&root->state) &&
extent_start != 0)
- inode_sub_bytes(&inode->vfs_info,
+ inode_sub_bytes(&inode->vfs_inode,
num_dec);
btrfs_mark_buffer_dirty(leaf);
} else {
--
2.25.1
next prev parent reply other threads:[~2020-11-02 14:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 14:48 [PATCH 00/14] Another batch of inode vs btrfs_inode cleanups Nikolay Borisov
2020-11-02 14:48 ` [PATCH 01/14] btrfs: Make btrfs_inode_safe_disk_i_size_write take btrfs_inode Nikolay Borisov
2020-11-02 14:48 ` [PATCH 02/14] btrfs: Make insert_prealloc_file_extent " Nikolay Borisov
2020-11-02 14:48 ` [PATCH 03/14] btrfs: Make btrfs_truncate_inode_items " Nikolay Borisov
2020-11-05 14:45 ` David Sterba
2020-11-02 14:48 ` Nikolay Borisov [this message]
2020-11-02 14:48 ` [PATCH 05/14] btrfs: Make btrfs_delayed_update_inode " Nikolay Borisov
2020-11-02 14:48 ` [PATCH 06/14] btrfs: Make btrfs_update_inode_item " Nikolay Borisov
2020-11-02 14:48 ` [PATCH 07/14] btrfs: Make btrfs_update_inode " Nikolay Borisov
2020-11-02 14:49 ` [PATCH 08/14] btrfs: Make maybe_insert_hole " Nikolay Borisov
2020-11-02 14:49 ` [PATCH 09/14] btrfs: Make find_first_non_hole " Nikolay Borisov
2020-11-02 14:49 ` [PATCH 10/14] btrfs: Make btrfs_insert_replace_extent " Nikolay Borisov
2020-11-02 14:49 ` [PATCH 11/14] btrfs: Make btrfs_truncate_block " Nikolay Borisov
2020-11-02 14:49 ` [PATCH 12/14] btrfs: Make btrfs_cont_expand " Nikolay Borisov
2020-11-02 14:49 ` [PATCH 13/14] btrfs: Make btrfs_drop_extents " Nikolay Borisov
2020-11-02 14:49 ` [PATCH 14/14] btrfs: Make btrfs_update_inode_fallback " Nikolay Borisov
2020-11-02 15:48 ` [PATCH 00/14] Another batch of inode vs btrfs_inode cleanups Johannes Thumshirn
2020-11-02 16:10 ` David Sterba
2020-11-02 16:25 ` Johannes Thumshirn
2020-11-05 16:21 ` David Sterba
2020-11-12 18:25 ` 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=20201102144906.3767963-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).