From patchwork Thu Mar 1 19:14:13 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: 10252243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E3B16037D for ; Thu, 1 Mar 2018 19:14:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D4722852C for ; Thu, 1 Mar 2018 19:14:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61D7A28534; Thu, 1 Mar 2018 19:14:23 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 DD1CB2852C for ; Thu, 1 Mar 2018 19:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161239AbeCATOW (ORCPT ); Thu, 1 Mar 2018 14:14:22 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:44766 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161214AbeCATOT (ORCPT ); Thu, 1 Mar 2018 14:14:19 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w21JCU0e082092; Thu, 1 Mar 2018 19:14:16 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-2017-10-26; bh=1sPeVsNYLfbJKJO4Hl1GBwT71PxUlPHEKhw21PPHtNU=; b=Sv6FsnRUsgsxn0wqor/hj736FpVWLn3UcthH1bvM3c8cqRpRYTmgd4KsFEji8cdqlHMr jZk2f3og1BEiouqyjiJqCI1rDZTSzLkDlnRiuLNcbqXQXjb0lF+sGBWiU7UAfHH9j9ve z72r/nJ6/4tfL38zmev9tjuhf92J4gHFus/zhTNX0wwgg3bbKnRghpjCbWUbrLFG/azj SSc7ePMTKu90VpZfJBcLEeYT+HEnRP7a4t0roReiPsMGL7M5E64CrWIoDg8GlfIqYtOv vLDlYpbwurSFCD9WuL4j8Q1rSaaHq9Il0LIHKSX+hFdeDfRyaLEPggEHX1GIfjedB8Wk bw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2gep97gcd7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Mar 2018 19:14:15 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w21JEE0o028496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Mar 2018 19:14:15 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w21JEE2K007196; Thu, 1 Mar 2018 19:14:14 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Mar 2018 11:14:14 -0800 Subject: [PATCH 11/16] mkfs: use geometry generation / helper functions From: "Darrick J. Wong" To: sandeen@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, djwong@kernel.org Date: Thu, 01 Mar 2018 11:14:13 -0800 Message-ID: <151993165335.22223.8818718662877576511.stgit@magnolia> In-Reply-To: <151993157539.22223.6269629008244777191.stgit@magnolia> References: <151993157539.22223.6269629008244777191.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8819 signatures=668682 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-1711220000 definitions=main-1803010237 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 Since libxfs now has a function to fill out the geometry structure and libfrog has a function to pretty-print the geometry, have mkfs use the two helpers instead of open-coding it. Signed-off-by: Darrick J. Wong --- libxfs/libxfs_api_defs.h | 1 + mkfs/xfs_mkfs.c | 54 ++++++++++++++-------------------------------- 2 files changed, 18 insertions(+), 37 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 5d56340..a23a28d 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -150,5 +150,6 @@ #define xfs_rmap_lookup_le_range libxfs_rmap_lookup_le_range #define xfs_refc_block libxfs_refc_block #define xfs_rmap_compare libxfs_rmap_compare +#define xfs_fs_geometry libxfs_fs_geometry #endif /* __LIBXFS_API_DEFS_H__ */ diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index f973b6b..c234b93 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -20,7 +20,7 @@ #include #include "xfs_multidisk.h" #include "libxcmd.h" - +#include "fsgeom.h" #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog))) @@ -3172,40 +3172,6 @@ initialise_mount( mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT; } -static void -print_mkfs_cfg( - struct mkfs_params *cfg, - char *dfile, - char *logfile, - char *rtfile) -{ - struct sb_feat_args *fp = &cfg->sb_feat; - - printf(_( -"meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n" -" =%-22s sectsz=%-5u attr=%u, projid32bit=%u\n" -" =%-22s crc=%-8u finobt=%u, sparse=%u, rmapbt=%u, reflink=%u\n" -"data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n" -" =%-22s sunit=%-6u swidth=%u blks\n" -"naming =version %-14u bsize=%-6u ascii-ci=%d ftype=%d\n" -"log =%-22s bsize=%-6d blocks=%lld, version=%d\n" -" =%-22s sectsz=%-5u sunit=%d blks, lazy-count=%d\n" -"realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"), - dfile, cfg->inodesize, (long long)cfg->agcount, - (long long)cfg->agsize, - "", cfg->sectorsize, fp->attr_version, fp->projid32bit, - "", fp->crcs_enabled, fp->finobt, fp->spinodes, fp->rmapbt, - fp->reflink, - "", cfg->blocksize, (long long)cfg->dblocks, cfg->imaxpct, - "", cfg->dsunit, cfg->dswidth, - fp->dir_version, cfg->dirblocksize, fp->nci, fp->dirftype, - logfile, cfg->blocksize, (long long)cfg->logblocks, - fp->log_version, - "", cfg->lsectorsize, cfg->lsunit, fp->lazy_sb_counters, - rtfile, (int)cfg->rtextblocks << cfg->blocklog, - (long long)cfg->rtblocks, (long long)cfg->rtextents); -} - /* * Format everything from the generated config into the superblock that * will be used to initialise the on-disk superblock. This is the in-memory @@ -3967,12 +3933,26 @@ main( */ calculate_log_size(&cfg, &cli, mp); + finish_superblock_setup(&cfg, mp, sbp); + + /* Print the intended geometry of the fs. */ if (!quiet || dry_run) { - print_mkfs_cfg(&cfg, dfile, logfile, rtfile); + struct xfs_fsop_geom geo; + int error; + + error = -libxfs_fs_geometry(sbp, &geo, + XFS_FS_GEOM_MAX_STRUCT_VER); + if (error) { + fprintf(stderr, + _("%s: failed to generate filesystem geometry\n"), + progname); + exit(1); + } + + xfs_report_geom(&geo, dfile, logfile, rtfile); if (dry_run) exit(0); } - finish_superblock_setup(&cfg, mp, sbp); /* * we need the libxfs buffer cache from here on in.