public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/3] xfs_io: add inode -l argument to return largest inode number
Date: Wed, 7 Oct 2015 10:06:28 +0200	[thread overview]
Message-ID: <20151007080628.GA8866@redhat.com> (raw)
In-Reply-To: <20151006170039.GC63205@bfoster.bfoster>

On Tue, Oct 06, 2015 at 01:00:39PM -0400, Brian Foster wrote:
> On Fri, Sep 25, 2015 at 03:07:46PM +0200, Carlos Maiolino wrote:
> > Implements '-l' argument in inode command, returning to the user, the largest
> > inode allocated and used in the filesystem.
> > 
> > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> > ---
> >  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);
> 
> Hmm, do we need the -s option if we have -l to print the actual largest
> inode number?
> 

Well, I understand your question, my point here was to implement the options
Dave suggested, but I'm not sure if he had in mind anything else that checking
the return value size of -l would not work as -s argument.

> Brian
> 
> >  
> >  	}
> >  
> > @@ -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

-- 
Carlos

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-10-07  8:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 13:07 [PATCH 0/3 V2] xfs_io: implement 'inode' command Carlos Maiolino
2015-09-25 13:07 ` [PATCH 1/3] xfs_io: Add inode '-s' command to query physical size of largest inode Carlos Maiolino
2015-09-25 13:12   ` Carlos Maiolino
2015-10-06 17:00   ` Brian Foster
2015-09-25 13:07 ` [PATCH 2/3] xfs_io: add inode -l argument to return largest inode number Carlos Maiolino
2015-10-06 17:00   ` Brian Foster
2015-10-07  8:06     ` Carlos Maiolino [this message]
2015-09-25 13:07 ` [PATCH 3/3] xfs_io: implement inode '-n' and [num] argument Carlos Maiolino
2015-10-06 17:00   ` Brian Foster
2015-10-09  8:33     ` Carlos Maiolino
2015-10-09 12:36       ` Brian Foster
2015-10-09 13:25         ` Carlos Maiolino

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=20151007080628.GA8866@redhat.com \
    --to=cmaiolino@redhat.com \
    --cc=bfoster@redhat.com \
    --cc=xfs@oss.sgi.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