From patchwork Mon May 20 23:17:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10952571 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 C471B1390 for ; Mon, 20 May 2019 23:18:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B28352015F for ; Mon, 20 May 2019 23:18:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6FC8288A7; Mon, 20 May 2019 23:18:00 +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 565BA2015F for ; Mon, 20 May 2019 23:18:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726584AbfETXSA (ORCPT ); Mon, 20 May 2019 19:18:00 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:37596 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbfETXR7 (ORCPT ); Mon, 20 May 2019 19:17:59 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4KNDmfY149853; Mon, 20 May 2019 23:17:57 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=E0JnMRcL6jKfFc2GtoIlInDciJGciFZEt05yi6zS0B4=; b=QjxiuLdbiKz8gaWm10wnuJaLgheJkybrDW/eMMz8sdHIgk2y+p0kwuczHiouCl7SQkhe 80Wnii9qXZfQY0XAfWAh8p4MgvTgSE435A/Bf4tArOkmGWX6qyjisjney0YdZZJYv9RS GtLfcZuadCNGh9oQtOOkXX/MPGhEZ2ADLzX0RE+ADARkt7Y9cKrQB84lAV+zfp7GXP/7 mQ8R99+D52kqBQDGIccVwyARwUjtN0ogsn0poZV2sh5ODBF9i9B9i72okdyK915y4Ljy nq09gYfXKqKW+yqx5Uhi6MYIk8mfLkDBvcEATSO3AdQaEjYiNCRU1nsugMg+zeCnlpDK cQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 2sj7jdj5nn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 May 2019 23:17:57 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4KNHfbS077783; Mon, 20 May 2019 23:17:56 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2skudb28t6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 May 2019 23:17:56 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x4KNHtCs008239; Mon, 20 May 2019 23:17:55 GMT Received: from localhost (/10.159.247.197) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 20 May 2019 23:17:55 +0000 Subject: [PATCH 11/12] mkfs: validate start and end of aligned logs From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 20 May 2019 16:17:54 -0700 Message-ID: <155839427473.68606.3900005341580158051.stgit@magnolia> In-Reply-To: <155839420081.68606.4573219764134939943.stgit@magnolia> References: <155839420081.68606.4573219764134939943.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9263 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905200143 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9263 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905200142 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 Validate that the start and end of the log stay within a single AG if we adjust either end to align to stripe units. Signed-off-by: Darrick J. Wong --- mkfs/xfs_mkfs.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 5b66074d..8f84536e 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3044,15 +3044,28 @@ align_internal_log( struct xfs_mount *mp, int sunit) { + uint64_t logend; + /* round up log start if necessary */ if ((cfg->logstart % sunit) != 0) cfg->logstart = ((cfg->logstart + (sunit - 1)) / sunit) * sunit; + /* if our log start rounds into the next AG we're done */ + if (!xfs_verify_fsbno(mp, cfg->logstart)) { + fprintf(stderr, +_("Due to stripe alignment, the internal log start (%lld) cannot be aligned\n" + "within an allocation group.\n"), + (long long) cfg->logstart); + usage(); + } + /* round up/down the log size now */ align_log_size(cfg, sunit); /* check the aligned log still fits in an AG. */ - if (cfg->logblocks > cfg->agsize - XFS_FSB_TO_AGBNO(mp, cfg->logstart)) { + logend = cfg->logstart + cfg->logblocks - 1; + if (XFS_FSB_TO_AGNO(mp, cfg->logstart) != XFS_FSB_TO_AGNO(mp, logend) || + !xfs_verify_fsbno(mp, logend)) { fprintf(stderr, _("Due to stripe alignment, the internal log size (%lld) is too large.\n" "Must fit within an allocation group.\n"),