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 6/7] btrfs: Call submit_bio_hook directly for metadata pages
Date: Fri, 18 Sep 2020 16:34:38 +0300	[thread overview]
Message-ID: <20200918133439.23187-7-nborisov@suse.com> (raw)
In-Reply-To: <20200918133439.23187-1-nborisov@suse.com>

No need to go through a function pointer indirection simply call
submit_bio_hook directly by exporting and renaming the helper to
btrfs_submit_metadata_bio. This makes the code more readable and should
result in somewhat faster code due to no longer paying the price for
specualtive attack mitigations that come with indirect function calls.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/disk-io.c   | 7 +++----
 fs/btrfs/disk-io.h   | 2 ++
 fs/btrfs/extent_io.c | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 73937954f464..54f2b95cc305 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -815,9 +815,8 @@ static int check_async_write(struct btrfs_fs_info *fs_info,
 	return 1;
 }
 
-static blk_status_t btree_submit_bio_hook(struct inode *inode, struct bio *bio,
-					  int mirror_num,
-					  unsigned long bio_flags)
+blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
+				       int mirror_num, unsigned long bio_flags)
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
 	int async = check_async_write(fs_info, BTRFS_I(inode));
@@ -4637,5 +4636,5 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info)
 }
 
 static const struct extent_io_ops btree_extent_io_ops = {
-	.submit_bio_hook = btree_submit_bio_hook
+	.submit_bio_hook = NULL
 };
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index bc2e49246199..fee69ced58b4 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -79,6 +79,8 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
 int btrfs_validate_metadata_buffer(struct btrfs_io_bio *io_bio, u64 phy_offset,
 				   struct page *page, u64 start, u64 end,
 				   int mirror);
+blk_status_t btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio,
+				       int mirror_num, unsigned long bio_flags);
 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
 struct btrfs_root *btrfs_alloc_dummy_root(struct btrfs_fs_info *fs_info);
 #endif
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 8cabcb7642a9..4a00cfd4082f 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -172,8 +172,8 @@ int __must_check submit_one_bio(struct bio *bio, int mirror_num,
 		ret = btrfs_submit_data_bio(tree->private_data, bio, mirror_num,
 					    bio_flags);
 	else
-		ret = tree->ops->submit_bio_hook(tree->private_data, bio,
-						 mirror_num, bio_flags);
+		ret = btrfs_submit_metadata_bio(tree->private_data, bio,
+						mirror_num, bio_flags);
 
 	return blk_status_to_errno(ret);
 }
-- 
2.17.1


  parent reply	other threads:[~2020-09-18 13:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 13:34 [PATCH 0/7] Remove struct extent_io_ops Nikolay Borisov
2020-09-18 13:34 ` [PATCH 1/7] btrfs: Don't call readpage_end_io_hook for the btree inode Nikolay Borisov
2020-09-18 13:41   ` Nikolay Borisov
2020-09-21 14:54   ` Johannes Thumshirn
2020-09-21 17:45   ` David Sterba
2020-09-23  6:29     ` Nikolay Borisov
2020-09-23 14:10       ` David Sterba
2020-09-18 13:34 ` [PATCH 2/7] btrfs: Remove extent_io_ops::readpage_end_io_hook Nikolay Borisov
2020-09-21 14:58   ` Johannes Thumshirn
2020-09-18 13:34 ` [PATCH 3/7] btrfs: Call submit_bio_hook directly in submit_one_bio Nikolay Borisov
2020-09-18 13:34 ` [PATCH 4/7] btrfs: Don't opencode is_data_inode in end_bio_extent_readpage Nikolay Borisov
2020-09-21 20:29   ` David Sterba
2020-09-23  6:23     ` Nikolay Borisov
2020-09-23 14:11       ` David Sterba
2020-09-18 13:34 ` [PATCH 5/7] btrfs: Stop calling submit_bio_hook for data inodes Nikolay Borisov
2020-09-18 13:34 ` Nikolay Borisov [this message]
2020-09-21 15:04   ` [PATCH 6/7] btrfs: Call submit_bio_hook directly for metadata pages Johannes Thumshirn
2020-09-21 20:32     ` David Sterba
2020-09-23  6:24       ` Nikolay Borisov
2020-09-18 13:34 ` [PATCH 7/7] btrfs: Remove struct extent_io_ops Nikolay Borisov
2020-09-21 20:38   ` David Sterba
2020-09-23  6:25     ` Nikolay Borisov
2020-09-23 14:19       ` David Sterba
2020-09-23 14:23         ` Nikolay Borisov
2020-09-23 15:09           ` David Sterba
2020-09-21 15:05 ` [PATCH 0/7] " Johannes Thumshirn
2020-09-24 11:35 ` 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=20200918133439.23187-7-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.