From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: josef@toxicpanda.com
Subject: [PATCH 5/5] btrfs: scrub_checksum_data() drop its function declaration
Date: Wed, 10 Feb 2021 21:25:19 -0800 [thread overview]
Message-ID: <46c9cb7e4a50fc9c40d7dea000f5285e5997124f.1613019838.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1613019838.git.anand.jain@oracle.com>
Move scrub_checksum_data() before its use, and drop its declaration.
No functional changes.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/scrub.c | 61 ++++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 31 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index bc335dd6a54f..62ea81eded03 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -220,7 +220,6 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad,
static void scrub_write_block_to_dev_replace(struct scrub_block *sblock);
static int scrub_write_page_to_dev_replace(struct scrub_block *sblock,
int page_num);
-static int scrub_checksum_data(struct scrub_block *sblock);
static int scrub_checksum_super(struct scrub_block *sblock);
static void scrub_block_put(struct scrub_block *sblock);
static void scrub_page_get(struct scrub_page *spage);
@@ -1505,6 +1504,36 @@ static inline int scrub_check_fsid(u8 fsid[],
return !ret;
}
+static int scrub_checksum_data(struct scrub_block *sblock)
+{
+ struct scrub_ctx *sctx = sblock->sctx;
+ struct btrfs_fs_info *fs_info = sctx->fs_info;
+ SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
+ u8 csum[BTRFS_CSUM_SIZE];
+ struct scrub_page *spage;
+ char *kaddr;
+
+ BUG_ON(sblock->page_count < 1);
+ spage = sblock->pagev[0];
+ if (!spage->have_csum)
+ return 0;
+
+ kaddr = page_address(spage->page);
+
+ shash->tfm = fs_info->csum_shash;
+ crypto_shash_init(shash);
+
+ /*
+ * In scrub_pages() and scrub_pages_for_parity() we ensure each spage
+ * only contains one sector of data.
+ */
+ crypto_shash_digest(shash, kaddr, fs_info->sectorsize, csum);
+
+ if (memcmp(csum, spage->csum, fs_info->csum_size))
+ sblock->checksum_error = 1;
+ return sblock->checksum_error;
+}
+
static int scrub_checksum_tree_block(struct scrub_block *sblock)
{
struct scrub_ctx *sctx = sblock->sctx;
@@ -1870,36 +1899,6 @@ static int scrub_checksum(struct scrub_block *sblock)
return ret;
}
-static int scrub_checksum_data(struct scrub_block *sblock)
-{
- struct scrub_ctx *sctx = sblock->sctx;
- struct btrfs_fs_info *fs_info = sctx->fs_info;
- SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
- u8 csum[BTRFS_CSUM_SIZE];
- struct scrub_page *spage;
- char *kaddr;
-
- BUG_ON(sblock->page_count < 1);
- spage = sblock->pagev[0];
- if (!spage->have_csum)
- return 0;
-
- kaddr = page_address(spage->page);
-
- shash->tfm = fs_info->csum_shash;
- crypto_shash_init(shash);
-
- /*
- * In scrub_pages() and scrub_pages_for_parity() we ensure each spage
- * only contains one sector of data.
- */
- crypto_shash_digest(shash, kaddr, fs_info->sectorsize, csum);
-
- if (memcmp(csum, spage->csum, fs_info->csum_size))
- sblock->checksum_error = 1;
- return sblock->checksum_error;
-}
-
static int scrub_checksum_super(struct scrub_block *sblock)
{
struct btrfs_super_block *s;
--
2.27.0
next prev parent reply other threads:[~2021-02-11 5:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-11 5:25 [PATCH 0/5] cleanups btrfs_extent_readonly() and scrub, part1 Anand Jain
2021-02-11 5:25 ` [PATCH 1/5] btrfs: make btrfs_extent_readonly() static Anand Jain
2021-02-11 5:25 ` [PATCH 2/5] btrfs: btrfs_extent_readonly() change return type to bool Anand Jain
2021-02-11 13:00 ` Johannes Thumshirn
2021-02-11 5:25 ` [PATCH 3/5] btrfs: scrub drop few function declarations Anand Jain
2021-02-11 13:27 ` Johannes Thumshirn
2021-02-11 5:25 ` [PATCH 4/5] btrfs: scrub_checksum_tree_block() drop its function declaration Anand Jain
2021-02-11 13:28 ` Johannes Thumshirn
2021-02-12 14:36 ` David Sterba
2021-02-25 1:21 ` Anand Jain
2021-02-25 16:16 ` David Sterba
2021-02-11 5:25 ` Anand Jain [this message]
2021-02-11 13:30 ` [PATCH 5/5] btrfs: scrub_checksum_data() " Johannes Thumshirn
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=46c9cb7e4a50fc9c40d7dea000f5285e5997124f.1613019838.git.anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=josef@toxicpanda.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).