From patchwork Mon Jun 3 14:58:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 10972991 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12FEE933 for ; Mon, 3 Jun 2019 14:59:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0499727CEE for ; Mon, 3 Jun 2019 14:59:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED527286EC; Mon, 3 Jun 2019 14:59:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 936FE283AD for ; Mon, 3 Jun 2019 14:59:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729383AbfFCO7L (ORCPT ); Mon, 3 Jun 2019 10:59:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:32778 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729364AbfFCO7F (ORCPT ); Mon, 3 Jun 2019 10:59:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EF6FAAFDB; Mon, 3 Jun 2019 14:59:02 +0000 (UTC) From: Johannes Thumshirn To: David Sterba Cc: Linux BTRFS Mailinglist , Chris Mason , Richard Weinberger , David Gstir , Nikolay Borisov , Johannes Thumshirn Subject: [PATCH v4 12/13] btrfs: remove assumption about csum type form btrfs_print_data_csum_error() Date: Mon, 3 Jun 2019 16:58:58 +0200 Message-Id: <20190603145859.7176-13-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190603145859.7176-1-jthumshirn@suse.de> References: <20190603145859.7176-1-jthumshirn@suse.de> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP btrfs_print_data_csum_error() still assumed checksums to be 32 bit in size. Make it size agnostic. Signed-off-by: Johannes Thumshirn Reviewed-by: Nikolay Borisov --- fs/btrfs/btrfs_inode.h | 10 +++++----- fs/btrfs/compression.c | 2 +- fs/btrfs/inode.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 4543f4864b2d..7a89f73b13e6 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -341,7 +341,7 @@ static inline void btrfs_inode_resume_unlocked_dio(struct btrfs_inode *inode) #define CSUM_FORMAT_VALUE(size, bytes) size, bytes static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode, - u64 logical_start, u32 csum, u32 csum_expected, int mirror_num) + u64 logical_start, u8 *csum, u8 *csum_expected, int mirror_num) { struct btrfs_root *root = inode->root; struct btrfs_super_block *sb = root->fs_info->super_copy; @@ -352,15 +352,15 @@ static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode, btrfs_warn_rl(root->fs_info, "csum failed root %lld ino %lld off %llu csum " CSUM_FORMAT " expected csum " CSUM_FORMAT " mirror %d", root->root_key.objectid, btrfs_ino(inode), - logical_start, CSUM_FORMAT_VALUE(csum_size, &csum), - CSUM_FORMAT_VALUE(csum_size, &csum_expected), + logical_start, CSUM_FORMAT_VALUE(csum_size, csum), + CSUM_FORMAT_VALUE(csum_size, csum_expected), mirror_num); else btrfs_warn_rl(root->fs_info, "csum failed root %llu ino %llu off %llu csum " CSUM_FORMAT " expected csum " CSUM_FORMAT " mirror %d", root->root_key.objectid, btrfs_ino(inode), - logical_start, CSUM_FORMAT_VALUE(csum_size, &csum), - CSUM_FORMAT_VALUE(csum_size, &csum_expected), + logical_start, CSUM_FORMAT_VALUE(csum_size, csum), + CSUM_FORMAT_VALUE(csum_size, csum_expected), mirror_num); } diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index e027e58358be..358a85d77108 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -86,7 +86,7 @@ static int check_compressed_csum(struct btrfs_inode *inode, if (memcmp(&csum, cb_sum, csum_size)) { btrfs_print_data_csum_error(inode, disk_start, - *(u32 *)csum, *(u32 *)cb_sum, + csum, cb_sum, cb->mirror_num); ret = -EIO; goto fail; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 402c9ea8239d..af27dddcb05f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3226,8 +3226,8 @@ static int __readpage_endio_check(struct inode *inode, kunmap_atomic(kaddr); return 0; zeroit: - btrfs_print_data_csum_error(BTRFS_I(inode), start, *(u32 *)csum, - *(u32 *)csum_expected, io_bio->mirror_num); + btrfs_print_data_csum_error(BTRFS_I(inode), start, csum, csum_expected, + io_bio->mirror_num); memset(kaddr + pgoff, 1, len); flush_dcache_page(page); kunmap_atomic(kaddr);