From patchwork Wed Apr 18 02:45:42 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: 10347255 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 4A57060365 for ; Wed, 18 Apr 2018 02:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D23C27F7F for ; Wed, 18 Apr 2018 02:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31CD32834A; Wed, 18 Apr 2018 02:46:12 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 B6A6427F7F for ; Wed, 18 Apr 2018 02:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753144AbeDRCqL (ORCPT ); Tue, 17 Apr 2018 22:46:11 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:51666 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753031AbeDRCqK (ORCPT ); Tue, 17 Apr 2018 22:46:10 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3I2fs0e170955; Wed, 18 Apr 2018 02:45:53 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=bmkAP3L8DlPZu91utbtJ3EnuDdK7Zhpsc+kL0j3jQQc=; b=j5eUyM1Jp58xgta7y6mlba82LamTrV5xgUeOcofqbHUcV86oU4TMqEvTYz1Bj4p8Hm4I n1klYjP30FXJq3GrJZIivwa1QMrYn+XAiUK8YWFc7RtPVdASZRbj0aWOAuw71a/RbjUX aZz/hgaT+Y0N6a3PC58Lv9oZHFlmAKQvfSaxsi4U/GoPI3DhP2KjZAOshP50wQStBkTA oJ/Z92RvPitFxUZlSwqDte+mH1ie1yoHxesIFZO4TJeSE7wfbIODqGbj9+2+k2ND3VCv eUdU5Tq9MOAAk98ds75LaENRimx2MJ3uZhHt6gu9tsRlq80HZDXB4ZN5b5EU8XTnqGT8 ew== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2hdrxn8jve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Apr 2018 02:45:53 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w3I2jqwA025764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Apr 2018 02:45:52 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3I2jpe6000403; Wed, 18 Apr 2018 02:45:51 GMT Received: from localhost (/10.159.132.124) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Apr 2018 19:45:51 -0700 Subject: [PATCH 3/9] mkfs: use geometry generation / helper functions From: "Darrick J. Wong" To: sandeen@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 17 Apr 2018 19:45:42 -0700 Message-ID: <152401954281.13048.8462957622341585756.stgit@magnolia> In-Reply-To: <152401952391.13048.15040850425873030425.stgit@magnolia> References: <152401952391.13048.15040850425873030425.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8866 signatures=668698 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-1804180023 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 Reviewed-by: Eric Sandeen --- 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 78daca0..09f1428 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -152,5 +152,6 @@ #define xfs_rmap_compare libxfs_rmap_compare #define xfs_dir_get_ops libxfs_dir_get_ops #define xfs_default_ifork_ops libxfs_default_ifork_ops +#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 78d0ce5..81f2123 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.