All of lore.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 2/9] btrfs: scrub: unify naming of page address variables
Date: Mon,  1 Jun 2020 17:23:05 +0200	[thread overview]
Message-ID: <af376a3c9d0f2ed26aa4be3c8343dde9ccf2dadf.1591024792.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1591024792.git.dsterba@suse.com>

As the page mapping has been removed, rename the variables to 'kaddr'
that we use everywhere else. The type is changed to 'char *' so pointer
arithmetic works without casts.

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

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 368791b17bac..7dc4a090db57 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1788,7 +1788,7 @@ static int scrub_checksum_data(struct scrub_block *sblock)
 	u8 csum[BTRFS_CSUM_SIZE];
 	u8 *on_disk_csum;
 	struct page *page;
-	void *buffer;
+	char *kaddr;
 	u64 len;
 	int index;
 
@@ -1801,14 +1801,14 @@ static int scrub_checksum_data(struct scrub_block *sblock)
 
 	on_disk_csum = sblock->pagev[0]->csum;
 	page = sblock->pagev[0]->page;
-	buffer = page_address(page);
+	kaddr = page_address(page);
 
 	len = sctx->fs_info->sectorsize;
 	index = 0;
 	for (;;) {
 		u64 l = min_t(u64, len, PAGE_SIZE);
 
-		crypto_shash_update(shash, buffer, l);
+		crypto_shash_update(shash, kaddr, l);
 		len -= l;
 		if (len == 0)
 			break;
@@ -1816,7 +1816,7 @@ static int scrub_checksum_data(struct scrub_block *sblock)
 		BUG_ON(index >= sblock->page_count);
 		BUG_ON(!sblock->pagev[index]->page);
 		page = sblock->pagev[index]->page;
-		buffer = page_address(page);
+		kaddr = page_address(page);
 	}
 
 	crypto_shash_final(shash, csum);
@@ -1835,7 +1835,7 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
 	u8 calculated_csum[BTRFS_CSUM_SIZE];
 	u8 on_disk_csum[BTRFS_CSUM_SIZE];
 	struct page *page;
-	void *mapped_buffer;
+	char *kaddr;
 	u64 mapped_size;
 	void *p;
 	u64 len;
@@ -1846,8 +1846,8 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
 
 	BUG_ON(sblock->page_count < 1);
 	page = sblock->pagev[0]->page;
-	mapped_buffer = page_address(page);
-	h = (struct btrfs_header *)mapped_buffer;
+	kaddr = page_address(page);
+	h = (struct btrfs_header *)kaddr;
 	memcpy(on_disk_csum, h->csum, sctx->csum_size);
 
 	/*
@@ -1872,7 +1872,7 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
 
 	len = sctx->fs_info->nodesize - BTRFS_CSUM_SIZE;
 	mapped_size = PAGE_SIZE - BTRFS_CSUM_SIZE;
-	p = ((u8 *)mapped_buffer) + BTRFS_CSUM_SIZE;
+	p = kaddr + BTRFS_CSUM_SIZE;
 	index = 0;
 	for (;;) {
 		u64 l = min_t(u64, len, mapped_size);
@@ -1885,9 +1885,9 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
 		BUG_ON(index >= sblock->page_count);
 		BUG_ON(!sblock->pagev[index]->page);
 		page = sblock->pagev[index]->page;
-		mapped_buffer = page_address(page);
+		kaddr = page_address(page);
 		mapped_size = PAGE_SIZE;
-		p = mapped_buffer;
+		p = kaddr;
 	}
 
 	crypto_shash_final(shash, calculated_csum);
@@ -1906,7 +1906,7 @@ static int scrub_checksum_super(struct scrub_block *sblock)
 	u8 calculated_csum[BTRFS_CSUM_SIZE];
 	u8 on_disk_csum[BTRFS_CSUM_SIZE];
 	struct page *page;
-	void *mapped_buffer;
+	char *kaddr;
 	u64 mapped_size;
 	void *p;
 	int fail_gen = 0;
@@ -1919,8 +1919,8 @@ static int scrub_checksum_super(struct scrub_block *sblock)
 
 	BUG_ON(sblock->page_count < 1);
 	page = sblock->pagev[0]->page;
-	mapped_buffer = page_address(page);
-	s = (struct btrfs_super_block *)mapped_buffer;
+	kaddr = page_address(page);
+	s = (struct btrfs_super_block *)kaddr;
 	memcpy(on_disk_csum, s->csum, sctx->csum_size);
 
 	if (sblock->pagev[0]->logical != btrfs_super_bytenr(s))
@@ -1934,7 +1934,7 @@ static int scrub_checksum_super(struct scrub_block *sblock)
 
 	len = BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE;
 	mapped_size = PAGE_SIZE - BTRFS_CSUM_SIZE;
-	p = ((u8 *)mapped_buffer) + BTRFS_CSUM_SIZE;
+	p = kaddr + BTRFS_CSUM_SIZE;
 	index = 0;
 	for (;;) {
 		u64 l = min_t(u64, len, mapped_size);
@@ -1947,9 +1947,9 @@ static int scrub_checksum_super(struct scrub_block *sblock)
 		BUG_ON(index >= sblock->page_count);
 		BUG_ON(!sblock->pagev[index]->page);
 		page = sblock->pagev[index]->page;
-		mapped_buffer = page_address(page);
+		kaddr = page_address(page);
 		mapped_size = PAGE_SIZE;
-		p = mapped_buffer;
+		p = kaddr;
 	}
 
 	crypto_shash_final(shash, calculated_csum);
-- 
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 ` David Sterba [this message]
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 ` [PATCH 9/9] btrfs: scrub: clean up temporary page variables in scrub_checksum_tree_block 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=af376a3c9d0f2ed26aa4be3c8343dde9ccf2dadf.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 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.