From patchwork Wed Apr 18 02:45:36 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: 10347251 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 D425060244 for ; Wed, 18 Apr 2018 02:45:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C333027F7F for ; Wed, 18 Apr 2018 02:45:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4A462834A; Wed, 18 Apr 2018 02:45:57 +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 040EC27F7F for ; Wed, 18 Apr 2018 02:45:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753165AbeDRCp4 (ORCPT ); Tue, 17 Apr 2018 22:45:56 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:46340 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076AbeDRCpz (ORCPT ); Tue, 17 Apr 2018 22:45:55 -0400 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 w3I2hd8Q047079; Wed, 18 Apr 2018 02:45:38 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=iWbPIBlkpQTQt18Px1yXjSd3UiP+2QQaDAdWK90bDQw=; b=mTNzkgguftRI9EIuqXIKMSkVXnvlO7wfTUyn+utdoOS3iIgaSFwydfxgbd2OfeyKBWWc wfTZSGz+TT7693vzkemvpKRur/ClCWrv7YYLSTj4C7OmzM76q26Pc82ODFxNwdSf31e4 tRgNSU4wY8EYVPkC5d0QiZYmpRGBx2CVwhUptEGVdp5fmlYUbS/OrCKlVAC6kyjeQULw /KVuaPN51gzvzpq7+IMD5R8zOd1CyVFrCPWIHvFhFc6ifR7kBtRhwcl5Hn53ksEJOtw6 3r2wZ+DDb2Vukg+FjKlecTn+i/K01/JkOcFn4T4Nxi2C66t3C2He6o2KHwuCY53J8ipy /A== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2hdrxp0k8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Apr 2018 02:45:38 +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 w3I2jbv4021195 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Apr 2018 02:45:38 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w3I2jbIA027962; Wed, 18 Apr 2018 02:45:37 GMT Received: from localhost (/10.159.132.124) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Apr 2018 19:45:37 -0700 Subject: [PATCH 2/9] libfrog: refactor fs geometry printing function 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:36 -0700 Message-ID: <152401953658.13048.467837665188564402.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=803 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 Move the fs geometry printing function to libfrog so that mkfs and others can share. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- include/fsgeom.h | 24 ++++++++++++++++ libfrog/Makefile | 1 + libfrog/fsgeom.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 include/fsgeom.h create mode 100644 libfrog/fsgeom.c -- 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/include/fsgeom.h b/include/fsgeom.h new file mode 100644 index 0000000..acf11bf --- /dev/null +++ b/include/fsgeom.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2000-2005 Silicon Graphics, Inc. + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef _LIBFROG_FSGEOM_H_ +#define _LIBFROG_FSGEOM_H_ + +void xfs_report_geom(struct xfs_fsop_geom *geo, const char *mntpoint, + const char *logname, const char *rtname); + +#endif /* _LIBFROG_FSGEOM_H_ */ diff --git a/libfrog/Makefile b/libfrog/Makefile index 21bb5b7..f682829 100644 --- a/libfrog/Makefile +++ b/libfrog/Makefile @@ -13,6 +13,7 @@ LT_AGE = 0 CFILES = \ avl64.c \ convert.c \ +fsgeom.c \ list_sort.c \ paths.c \ projects.c \ diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c new file mode 100644 index 0000000..cbe847a --- /dev/null +++ b/libfrog/fsgeom.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2000-2005 Silicon Graphics, Inc. + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "libxfs.h" +#include "fsgeom.h" + +void +xfs_report_geom( + struct xfs_fsop_geom *geo, + const char *mntpoint, + const char *logname, + const char *rtname) +{ + int isint; + int lazycount; + int dirversion; + int logversion; + int attrversion; + int projid32bit; + int crcs_enabled; + int cimode; + int ftype_enabled; + int finobt_enabled; + int spinodes; + int rmapbt_enabled; + int reflink_enabled; + + isint = geo->logstart > 0; + lazycount = geo->flags & XFS_FSOP_GEOM_FLAGS_LAZYSB ? 1 : 0; + dirversion = geo->flags & XFS_FSOP_GEOM_FLAGS_DIRV2 ? 2 : 1; + logversion = geo->flags & XFS_FSOP_GEOM_FLAGS_LOGV2 ? 2 : 1; + attrversion = geo->flags & XFS_FSOP_GEOM_FLAGS_ATTR2 ? 2 : \ + (geo->flags & XFS_FSOP_GEOM_FLAGS_ATTR ? 1 : 0); + cimode = geo->flags & XFS_FSOP_GEOM_FLAGS_DIRV2CI ? 1 : 0; + projid32bit = geo->flags & XFS_FSOP_GEOM_FLAGS_PROJID32 ? 1 : 0; + crcs_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_V5SB ? 1 : 0; + ftype_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_FTYPE ? 1 : 0; + finobt_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_FINOBT ? 1 : 0; + spinodes = geo->flags & XFS_FSOP_GEOM_FLAGS_SPINODES ? 1 : 0; + rmapbt_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_RMAPBT ? 1 : 0; + reflink_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_REFLINK ? 1 : 0; + + printf(_( +"meta-data=%-22s isize=%-6d agcount=%u, agsize=%u blks\n" +" =%-22s sectsz=%-5u attr=%u, projid32bit=%u\n" +" =%-22s crc=%-8u finobt=%u, sparse=%u, rmapbt=%u\n" +" =%-22s 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=%u, version=%d\n" +" =%-22s sectsz=%-5u sunit=%d blks, lazy-count=%d\n" +"realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"), + mntpoint, geo->inodesize, geo->agcount, geo->agblocks, + "", geo->sectsize, attrversion, projid32bit, + "", crcs_enabled, finobt_enabled, spinodes, rmapbt_enabled, + "", reflink_enabled, + "", geo->blocksize, (unsigned long long)geo->datablocks, + geo->imaxpct, + "", geo->sunit, geo->swidth, + dirversion, geo->dirblocksize, cimode, ftype_enabled, + isint ? _("internal log") : logname ? logname : _("external"), + geo->blocksize, geo->logblocks, logversion, + "", geo->logsectsize, geo->logsunit / geo->blocksize, lazycount, + !geo->rtblocks ? _("none") : rtname ? rtname : _("external"), + geo->rtextsize * geo->blocksize, (unsigned long long)geo->rtblocks, + (unsigned long long)geo->rtextents); +}