Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@redhat.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 2/9] libfrog: refactor fs geometry printing function
Date: Tue, 17 Apr 2018 19:45:36 -0700	[thread overview]
Message-ID: <152401953658.13048.467837665188564402.stgit@magnolia> (raw)
In-Reply-To: <152401952391.13048.15040850425873030425.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Move the fs geometry printing function to libfrog so that mkfs and others
can share.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 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


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);
+}


  parent reply	other threads:[~2018-04-18  2:45 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18  2:45 [PATCH 0/9] xfsprogs-4.17: geometry refactoring Darrick J. Wong
2018-04-18  2:45 ` [PATCH 1/9] libfrog: move platform specific runtime support code out of libxfs Darrick J. Wong
2018-05-03 18:23   ` Eric Sandeen
2018-04-18  2:45 ` Darrick J. Wong [this message]
2018-05-03 18:47   ` [PATCH 2/9] libfrog: refactor fs geometry printing function Eric Sandeen
2018-05-03 21:27   ` Eric Sandeen
2018-05-03 21:35     ` Darrick J. Wong
2018-04-18  2:45 ` [PATCH 3/9] mkfs: use geometry generation / helper functions Darrick J. Wong
2018-05-03 18:52   ` Eric Sandeen
2018-04-18  2:45 ` [PATCH 4/9] xfs_db: add a superblock info command Darrick J. Wong
2018-05-03 20:53   ` Eric Sandeen
2018-05-03 21:44     ` Darrick J. Wong
2018-05-23  3:30   ` [PATCH v2 " Darrick J. Wong
2018-05-23  3:57     ` Allison Henderson
2018-04-18  2:46 ` [PATCH 5/9] xfs_spaceman: print a nicer message when the file path isn't on an xfs Darrick J. Wong
2018-05-03 20:57   ` Eric Sandeen
2018-05-23  3:31   ` [PATCH v2 " Darrick J. Wong
2018-05-23  3:58     ` Allison Henderson
2018-04-18  2:46 ` [PATCH 6/9] xfs_spaceman: add a superblock info command Darrick J. Wong
2018-05-03 21:09   ` Eric Sandeen
2018-05-03 21:39     ` Darrick J. Wong
2018-05-08 15:24       ` Darrick J. Wong
2018-05-23  3:32   ` [PATCH v2 " Darrick J. Wong
2018-05-23  4:08     ` Allison Henderson
2018-04-18  2:46 ` [PATCH 7/9] xfs_info: move to xfs_spaceman Darrick J. Wong
2018-05-03 21:17   ` Eric Sandeen
2018-05-03 21:48     ` Darrick J. Wong
2018-04-18  2:46 ` [PATCH 8/9] xfs_info: call xfs_db for offline filesystems Darrick J. Wong
2018-05-03 21:22   ` Eric Sandeen
2018-05-03 21:55     ` Darrick J. Wong
2018-05-23  3:33   ` [PATCH v2 " Darrick J. Wong
2018-05-23  4:36     ` Allison Henderson
2018-04-18  2:46 ` [PATCH 9/9] xfs_growfs: refactor geometry reporting Darrick J. Wong
2018-05-03 21:25   ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152401953658.13048.467837665188564402.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox