@@ -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;
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(-)