From patchwork Thu Nov 15 06:05:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10683581 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 19EAE1747 for ; Thu, 15 Nov 2018 06:05:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0852C2B4CE for ; Thu, 15 Nov 2018 06:05:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0D442C199; Thu, 15 Nov 2018 06:05:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 CE6322B4CE for ; Thu, 15 Nov 2018 06:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727045AbeKOQLk (ORCPT ); Thu, 15 Nov 2018 11:11:40 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:37110 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbeKOQLk (ORCPT ); Thu, 15 Nov 2018 11:11:40 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAF63lu9105760 for ; Thu, 15 Nov 2018 06:05:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=vYnjoPgTe5PUjlpYleGVTHb5SNmyjGVYqyrotEkU4k0=; b=05hoJVp9EmXLoipJftqZczVtLrrmxHkEeqTL/xtV6tApEfphnpaymNl8hZMNNovQHcAT G0JFvTPBemSjj+6NTkGeBRgfmJcvh+004EB2uHzkwg+GoXS65ioNzHt85oo5oGYPfDyq XGxx95tWOhaQsL/cIFyX+MtzeDsMYj4icECtDC3UMp1T1y/yaaI6F/y8n1RW62kMxwem 6FwBgKJoNLsakpRdfhJLv5ppeOcRvRVxFrIFCX9CFaxeMJwktKKhj+GQGxJru0eq7wsP UYMHrGyA/DYl0FcCpJkQ8lMTwNuI/jfo+Zh6bJgGOFUQZG4YcBydOMRWp5As1rlODpJE UA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2nr7cs7hu1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 15 Nov 2018 06:05:12 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAF656jP014258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 15 Nov 2018 06:05:06 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAF6565X023793 for ; Thu, 15 Nov 2018 06:05:06 GMT Received: from localhost (/10.159.153.160) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 Nov 2018 22:05:06 -0800 Subject: [PATCH 7/9] xfs: scrub big block inode btrees correctly From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Wed, 14 Nov 2018 22:05:05 -0800 Message-ID: <154226190517.13280.4528455687301041275.stgit@magnolia> In-Reply-To: <154226186169.13280.4536602352984659736.stgit@magnolia> References: <154226186169.13280.4536602352984659736.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9077 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=889 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811150055 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Teach scrub how to handle the case that there are one or more inobt records covering a given inode cluster. This fixes the operation on big block filesystems (e.g. 64k blocks, 512 byte inodes). Signed-off-by: Darrick J. Wong --- fs/xfs/scrub/ialloc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/xfs/scrub/ialloc.c b/fs/xfs/scrub/ialloc.c index 1d79f12dfce5..26bcf359b326 100644 --- a/fs/xfs/scrub/ialloc.c +++ b/fs/xfs/scrub/ialloc.c @@ -162,6 +162,7 @@ xchk_iallocbt_check_cluster_ifree( xfs_ino_t fsino; xfs_agino_t agino; unsigned int offset; + unsigned int cluster_buf_base; bool irec_free; bool ino_inuse; bool freemask_ok; @@ -174,11 +175,14 @@ xchk_iallocbt_check_cluster_ifree( * Given an inobt record, an offset of a cluster within the record, * and an offset of an inode within a cluster, compute which fs inode * we're talking about and the offset of the inode record within the - * inode buffer. + * inode buffer, being careful about inobt records that don't align + * with the start of the inode buffer when block sizes are large. */ agino = irec->ir_startino + cluster_base + cluster_index; fsino = XFS_AGINO_TO_INO(mp, bs->cur->bc_private.a.agno, agino); - offset = cluster_index * mp->m_sb.sb_inodesize; + cluster_buf_base = XFS_INO_TO_OFFSET(mp, irec->ir_startino + + cluster_base); + offset = (cluster_buf_base + cluster_index) * mp->m_sb.sb_inodesize; if (offset >= BBTOB(cluster_bp->b_length)) { xchk_btree_set_corrupt(bs->sc, bs->cur, 0); goto out;