linux-btrfs.vger.kernel.org archive mirror
 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 9/9] btrfs: scrub: clean up temporary page variables in scrub_checksum_tree_block
Date: Mon,  1 Jun 2020 17:23:21 +0200	[thread overview]
Message-ID: <cb51d704417c68e0100ddd2aabf11eb880821933.1591024792.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1591024792.git.dsterba@suse.com>

Add proper variable for the scrub page and use it instead of repeatedly
dereferencing the other structures.

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

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 663bb2c22c50..d935ac06323f 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1816,12 +1816,12 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
 	u8 on_disk_csum[BTRFS_CSUM_SIZE];
 	const int num_pages = sctx->fs_info->nodesize >> PAGE_SHIFT;
 	int i;
-	struct page *page;
+	struct scrub_page *spage;
 	char *kaddr;
 
 	BUG_ON(sblock->page_count < 1);
-	page = sblock->pagev[0]->page;
-	kaddr = page_address(page);
+	spage = sblock->pagev[0];
+	kaddr = page_address(spage->page);
 	h = (struct btrfs_header *)kaddr;
 	memcpy(on_disk_csum, h->csum, sctx->csum_size);
 
@@ -1830,15 +1830,15 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
 	 * a) don't have an extent buffer and
 	 * b) the page is already kmapped
 	 */
-	if (sblock->pagev[0]->logical != btrfs_stack_header_bytenr(h))
+	if (spage->logical != btrfs_stack_header_bytenr(h))
 		sblock->header_error = 1;
 
-	if (sblock->pagev[0]->generation != btrfs_stack_header_generation(h)) {
+	if (spage->generation != btrfs_stack_header_generation(h)) {
 		sblock->header_error = 1;
 		sblock->generation_error = 1;
 	}
 
-	if (!scrub_check_fsid(h->fsid, sblock->pagev[0]))
+	if (!scrub_check_fsid(h->fsid, spage))
 		sblock->header_error = 1;
 
 	if (memcmp(h->chunk_tree_uuid, fs_info->chunk_tree_uuid,
-- 
2.25.0


      parent reply	other threads:[~2020-06-01 15:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 15:23 [PATCH 0/9] Scrub cleanups David Sterba
2020-06-01 15:23 ` [PATCH 1/9] btrfs: scrub: remove kmap/kunmap of pages David Sterba
2020-06-01 15:23 ` [PATCH 2/9] btrfs: scrub: unify naming of page address variables David Sterba
2020-06-01 15:23 ` [PATCH 3/9] btrfs: scrub: simplify superblock checksum calculation David Sterba
2020-06-01 15:23 ` [PATCH 4/9] btrfs: scrub: remove temporary csum array in scrub_checksum_super David Sterba
2020-06-01 15:23 ` [PATCH 5/9] btrfs: scrub: clean up temporary page variables " David Sterba
2020-06-01 15:23 ` [PATCH 6/9] btrfs: scrub: simplify data block checksum calculation David Sterba
2020-06-01 15:23 ` [PATCH 7/9] btrfs: scrub: clean up temporary page variables in scrub_checksum_data David Sterba
2020-06-01 15:23 ` [PATCH 8/9] btrfs: scrub: simplify tree block checksum calculation David Sterba
2020-06-01 15:23 ` David Sterba [this message]

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=cb51d704417c68e0100ddd2aabf11eb880821933.1591024792.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;
as well as URLs for NNTP newsgroup(s).