Return-Path: Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (Postfix) with ESMTP id DE3E47F50 for ; Fri, 25 Sep 2015 08:08:00 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay3.corp.sgi.com (Postfix) with ESMTP id 82662AC004 for ; Fri, 25 Sep 2015 06:08:00 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id rEPpD1gmxjIjGbjh (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 25 Sep 2015 06:07:58 -0700 (PDT) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id ACD3C2589E for ; Fri, 25 Sep 2015 13:07:58 +0000 (UTC) Received: from zion.usersys.redhat.com (dhcp-26-103.brq.redhat.com [10.34.26.103]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8PD7pab000474 for ; Fri, 25 Sep 2015 09:07:58 -0400 From: Carlos Maiolino Subject: [PATCH 2/3] xfs_io: add inode -l argument to return largest inode number Date: Fri, 25 Sep 2015 15:07:46 +0200 Message-Id: <1443186467-20110-3-git-send-email-cmaiolino@redhat.com> In-Reply-To: <1443186467-20110-1-git-send-email-cmaiolino@redhat.com> References: <1443186467-20110-1-git-send-email-cmaiolino@redhat.com> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: xfs@oss.sgi.com Implements '-l' argument in inode command, returning to the user, the largest inode allocated and used in the filesystem. Signed-off-by: Carlos Maiolino --- io/open.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/io/open.c b/io/open.c index 6a794ba..57ff0bf 100644 --- a/io/open.c +++ b/io/open.c @@ -759,6 +759,7 @@ inode_help(void) "\n" "Query physical information about the inode" "\n" +" -l -- Returns the largest inode number in the filesystem\n" " -s -- Returns the physical size (in bits) of the\n" " largest inode number in the filesystem\n" "\n")); @@ -777,23 +778,27 @@ inode_f( struct xfs_fsop_bulkreq bulkreq; int c; int ret_lsize = 0; + int ret_largest = 0; bulkreq.lastip = &last; bulkreq.icount = 1024; /* maybe an user-defined value!? */ bulkreq.ubuffer = &igroup; bulkreq.ocount = &count; - while ((c = getopt(argc, argv, "s")) != EOF) { + while ((c = getopt(argc, argv, "sl")) != EOF) { switch (c) { case 's': ret_lsize = 1; break; + case 'l': + ret_largest = 1; + break; default: return command_usage(&inode_cmd); } } - if (ret_lsize) { + if (ret_lsize || ret_largest) { for (;;) { if (xfsctl(file->name, file->fd, XFS_IOC_FSINUMBERS, &bulkreq)) { @@ -811,8 +816,11 @@ inode_f( lastino = igroup[lastgrp].xi_startino + xfs_highbit64(igroup[lastgrp].xi_allocmask); - printf (_("Largest inode size: %d\n"), - lastino > XFS_MAXINUMBER_32 ? 64 : 32); + if (ret_lsize) + printf (_("Largest inode size: %d\n"), + lastino > XFS_MAXINUMBER_32 ? 64 : 32); + else + printf(_("Largest inode: %llu\n"), lastino); } @@ -887,7 +895,7 @@ open_init(void) inode_cmd.name = "inode"; inode_cmd.cfunc = inode_f; - inode_cmd.args = _("[-s]"); + inode_cmd.args = _("[-s | -l]"); inode_cmd.argmin = 1; inode_cmd.argmax = 1; inode_cmd.flags = CMD_NOMAP_OK; -- 2.4.3 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs