public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 5/5] btrfs: hoist fs_info out of loops in end_bbio_data_write and end_bbio_data_read
Date: Mon, 29 Jan 2024 19:33:20 +0100	[thread overview]
Message-ID: <fd6fef62df1f7d3d3da5380fecf1f51a64950286.1706553081.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1706553080.git.dsterba@suse.com>

The fs_info and sectorsize remain the same during the loops, no need to
set them on each iteration.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 9d6d4dab9ae3..d45247e1020a 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -464,13 +464,12 @@ static void end_bbio_data_write(struct btrfs_bio *bbio)
 	struct bio *bio = &bbio->bio;
 	int error = blk_status_to_errno(bio->bi_status);
 	struct folio_iter fi;
+	struct btrfs_fs_info *fs_info = bbio->fs_info;
+	const u32 sectorsize = fs_info->sectorsize;
 
 	ASSERT(!bio_flagged(bio, BIO_CLONED));
 	bio_for_each_folio_all(fi, bio) {
 		struct folio *folio = fi.folio;
-		struct inode *inode = folio->mapping->host;
-		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-		const u32 sectorsize = fs_info->sectorsize;
 		u64 start = folio_pos(folio) + fi.offset;
 		u32 len = fi.length;
 
@@ -592,17 +591,17 @@ static void begin_page_read(struct btrfs_fs_info *fs_info, struct page *page)
  */
 static void end_bbio_data_read(struct btrfs_bio *bbio)
 {
+	struct btrfs_fs_info *fs_info = bbio->fs_info;
 	struct bio *bio = &bbio->bio;
 	struct processed_extent processed = { 0 };
 	struct folio_iter fi;
+	const u32 sectorsize = fs_info->sectorsize;
 
 	ASSERT(!bio_flagged(bio, BIO_CLONED));
 	bio_for_each_folio_all(fi, &bbio->bio) {
 		bool uptodate = !bio->bi_status;
 		struct folio *folio = fi.folio;
 		struct inode *inode = folio->mapping->host;
-		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-		const u32 sectorsize = fs_info->sectorsize;
 		u64 start;
 		u64 end;
 		u32 len;
-- 
2.42.1


  parent reply	other threads:[~2024-01-29 18:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 18:33 [PATCH 0/5] Struct to fs_info helpers David Sterba
2024-01-29 18:33 ` [PATCH 1/5] btrfs: tests: allocate dummy fs_info and root in test_find_delalloc() David Sterba
2024-01-29 18:33 ` [PATCH 2/5] btrfs: add helpers to get inode from page/folio pointers David Sterba
2024-01-30 11:42   ` Johannes Thumshirn
2024-01-30 19:29     ` David Sterba
2024-01-31  9:33       ` Johannes Thumshirn
2024-01-31 17:19         ` David Sterba
2024-01-29 18:33 ` [PATCH 3/5] btrfs: add helpers to get fs_info " David Sterba
2024-01-30 11:58   ` Johannes Thumshirn
2024-01-30 19:32     ` David Sterba
2024-01-29 18:33 ` [PATCH 4/5] btrfs: add helper to get fs_info from struct inode pointer David Sterba
2024-01-30 11:49   ` Johannes Thumshirn
2024-01-30 19:31     ` David Sterba
2024-01-31  7:23   ` David Sterba
2024-01-31  8:43     ` Qu Wenruo
2024-01-31 18:04       ` David Sterba
2024-01-29 18:33 ` David Sterba [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-01 18:02 [PATCH 0/5 v2] Struct to fs_info helpers David Sterba
2024-02-01 18:02 ` [PATCH 5/5] btrfs: hoist fs_info out of loops in end_bbio_data_write and end_bbio_data_read 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=fd6fef62df1f7d3d3da5380fecf1f51a64950286.1706553081.git.dsterba@suse.com \
    --to=dsterba@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