public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs_io: Implement inodes64 command - bug in XFS_IOC_FSINUMBERS?
Date: Wed, 23 Sep 2015 08:24:02 -0400	[thread overview]
Message-ID: <20150923122401.GA37210@bfoster.bfoster> (raw)
In-Reply-To: <20150923102834.GA4490@redhat.com>

On Wed, Sep 23, 2015 at 12:28:34PM +0200, Carlos Maiolino wrote:
> Howdy folks,
> 
> I was working in implementing the suggested feature in my patch, about getting
> the next inode used after one is provided, and I hit something that I'm not really
> sure if this might be considered a bug, or just a work form.
> 
> XFS_IOC_FSINUMBERS, is supposed to be called with a zeroed
> xfs_fsop_bulkreq.lastip, so at each call, kernel will update this number to the
> last inode returned, and, the next call will return in xfs_inogrp.xi_startino,
> the next existing inode after .lastip.
> 
> So, I was expecting that, passing a non-zero .lastip at the first call, I would
> be able to get the next inode right after the one I passed through .lastip, but,
> after some tests and reading the code, I noticed that this is not the case.
> 
> The problem (not sure if I can really say it's a problem), is that, if the inode
> number passed, happens to be somewhere in the middle of an inode chunk, the
> whole chunk will not be printed, only the next inode chunk will start to be
> printed, hiding all information of the previous one.
> 
> I'm not sure if this is the desired behavior or not, but, I'd say that, if the
> inode passed in .lastip, is not the first in the chunk, the output should start
> for its own chunk, instead of the next one, but, I prefer to see you folks POV
> before starting to fix something that I'm not sure if it's actually broken :-)
> 

On a quick pass through, it seems like this is probably just the nature
of the granularity and typical use case of the inumbers interface. For
one, I think the lastip parameter is intended to be used as a cookie as
opposed to an inode-granularity search key. The return structures also
appear to describe inode records so there isn't any natural way to get a
partial record that I can see. Note that bulkstat does appear to support
an inode granularity starting point (see xfs_bulkstat_grab_ichunk()) as
the output format is inode granularity.

FWIW, I would probably try to handle something like the above in
userspace by working with the interface rather than modifying it. In
other words, subtract (at least) XFS_INODES_PER_CHUNK from the inode
number in question and use that as a starting point to ensure the output
contains the record for the inode if one exists.

It seems like you could change the inumbers behavior to return the
record that contains lastip + 1 if you really wanted to, we'd just have
to take care not to break the lastip behavior itself (e.g., we can't
just search for any record that contains lastip). What looks
interesting, and might justify doing something in this area, is the
behavior presumably caused by doing a greater than or equal to
(XFS_LOOKUP_GE) lookup in xfs_inumbers(). If lastino happens to be a
record startino, we'll actually return the record that contains that
inode (thus technically supporting a mid-record start). If the index in
the record is beyond that, we'll skip it and start at the next record.
Unless I misinterpret that, it seems like that should be fixed one way
or another.

Brian

> Cheers
> 
> -- 
> Carlos
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

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

  reply	other threads:[~2015-09-23 12:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-21  8:56 [PATCH] xfs_io: Implement inodes64 command Carlos Maiolino
2015-09-21 20:50 ` Eric Sandeen
2015-09-22  7:44   ` Carlos Maiolino
2015-09-21 22:08 ` Dave Chinner
2015-09-22  7:54   ` Carlos Maiolino
2015-09-22 12:22     ` Brian Foster
2015-09-22 22:00       ` Dave Chinner
2015-09-23 10:28         ` [PATCH] xfs_io: Implement inodes64 command - bug in XFS_IOC_FSINUMBERS? Carlos Maiolino
2015-09-23 12:24           ` Brian Foster [this message]
2015-09-23 23:10           ` Dave Chinner
2015-09-24  8:47             ` 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=20150923122401.GA37210@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.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