From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58D89C67863 for ; Tue, 23 Oct 2018 09:34:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2693120665 for ; Tue, 23 Oct 2018 09:34:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2693120665 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-btrfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728602AbeJWR5S (ORCPT ); Tue, 23 Oct 2018 13:57:18 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:2023 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728020AbeJWR5Q (ORCPT ); Tue, 23 Oct 2018 13:57:16 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="46602828" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 23 Oct 2018 17:34:36 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 366754B3305F for ; Tue, 23 Oct 2018 17:34:38 +0800 (CST) Received: from archlinux.g08.fujitsu.local (10.167.226.24) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 23 Oct 2018 17:34:44 +0800 From: Su Yue To: CC: Subject: [PATCH 05/13] btrfs-progs: lowmem: check unaligned disk_bytenr for extent_data Date: Tue, 23 Oct 2018 17:41:39 +0800 Message-ID: <20181023094147.7906-6-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181023094147.7906-1-suy.fnst@cn.fujitsu.com> References: <20181023094147.7906-1-suy.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.167.226.24] X-yoursite-MailScanner-ID: 366754B3305F.A8278 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suy.fnst@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Add support to check unaligned disk_bytenr for extent_data. Signed-off-by: Su Yue --- check/mode-lowmem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 35fe1adf58e6..e8a2e825c0f3 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -3103,7 +3103,14 @@ static int check_extent_data_item(struct btrfs_root *root, extent_num_bytes = btrfs_file_extent_num_bytes(eb, fi); offset = btrfs_file_extent_offset(eb, fi); - /* Check unaligned disk_num_bytes and num_bytes */ + /* Check unaligned disk_bytenr, disk_num_bytes and num_bytes */ + if (!IS_ALIGNED(disk_bytenr, root->fs_info->sectorsize)) { + error( +"file extent [%llu, %llu] has unaligned disk bytenr: %llu, should be aligned to %u", + fi_key.objectid, fi_key.offset, disk_bytenr, + root->fs_info->sectorsize); + err |= BYTES_UNALIGNED; + } if (!IS_ALIGNED(disk_num_bytes, root->fs_info->sectorsize)) { error( "file extent [%llu, %llu] has unaligned disk num bytes: %llu, should be aligned to %u", -- 2.19.1