All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs <linux-xfs@vger.kernel.org>,
	linux-api@vger.kernel.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] fsmap: fix documentation of FMR_OF_LAST
Date: Fri, 1 Sep 2017 08:07:16 -0700	[thread overview]
Message-ID: <20170901150716.GW3775@magnolia> (raw)
In-Reply-To: <20170901080904.GA32746@infradead.org>

On Fri, Sep 01, 2017 at 01:09:04AM -0700, Christoph Hellwig wrote:
> On Thu, Aug 31, 2017 at 01:49:18PM -0700, Darrick J. Wong wrote:
> > The FMR_OF_LAST flag is set on the last fsmap record being returned for
> > the dataset requested, contrary to what the header file says.  Fix the
> > docs to reflect the behavior of all fsmap implementations.
> 
> Hmm.  What's the point of the flag then given that you can trivially
> deduce the last entry from fmh_entries?

fmh_entries is the number of records returned, not the number of records
in the dataset.  If, for example, you allocate space for 100 records and
perform a query for a block that has been reflinked 1000 times, the
dataset size is 1000 but fmh_entries is set to 100.  The lack of a LAST
flag on the 100th record tells you that there's more records to return.

If however you allocate space for 100 records and the block is reflinked
exactly 100 times, there's no way (without the flag) for userspace to
know that record 100 is the end of the dataset, so the only thing it can
do is to fsmap_advance() and try the query again, only to receive zero
results.  Granted I don't think fsmap queries are all /that/ expensive,
but it's trivial for the kernel to set the flag.

--D

> --
> 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

WARNING: multiple messages have this Message-ID (diff)
From: "Darrick J. Wong" <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: xfs <linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fsdevel
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-ext4 <linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] fsmap: fix documentation of FMR_OF_LAST
Date: Fri, 1 Sep 2017 08:07:16 -0700	[thread overview]
Message-ID: <20170901150716.GW3775@magnolia> (raw)
In-Reply-To: <20170901080904.GA32746-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>

On Fri, Sep 01, 2017 at 01:09:04AM -0700, Christoph Hellwig wrote:
> On Thu, Aug 31, 2017 at 01:49:18PM -0700, Darrick J. Wong wrote:
> > The FMR_OF_LAST flag is set on the last fsmap record being returned for
> > the dataset requested, contrary to what the header file says.  Fix the
> > docs to reflect the behavior of all fsmap implementations.
> 
> Hmm.  What's the point of the flag then given that you can trivially
> deduce the last entry from fmh_entries?

fmh_entries is the number of records returned, not the number of records
in the dataset.  If, for example, you allocate space for 100 records and
perform a query for a block that has been reflinked 1000 times, the
dataset size is 1000 but fmh_entries is set to 100.  The lack of a LAST
flag on the 100th record tells you that there's more records to return.

If however you allocate space for 100 records and the block is reflinked
exactly 100 times, there's no way (without the flag) for userspace to
know that record 100 is the end of the dataset, so the only thing it can
do is to fsmap_advance() and try the query again, only to receive zero
results.  Granted I don't think fsmap queries are all /that/ expensive,
but it's trivial for the kernel to set the flag.

--D

> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-09-01 15:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31 20:49 [PATCH] fsmap: fix documentation of FMR_OF_LAST Darrick J. Wong
2017-09-01  0:30 ` Dave Chinner
2017-09-01  0:30   ` Dave Chinner
2017-09-01  8:09 ` Christoph Hellwig
2017-09-01  8:09   ` Christoph Hellwig
2017-09-01 15:07   ` Darrick J. Wong [this message]
2017-09-01 15:07     ` Darrick J. Wong
2017-09-03  8:41     ` Christoph Hellwig

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=20170901150716.GW3775@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.