linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsmap: fix documentation of FMR_OF_LAST
@ 2017-08-31 20:49 Darrick J. Wong
  2017-09-01  0:30 ` Dave Chinner
  2017-09-01  8:09 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Darrick J. Wong @ 2017-08-31 20:49 UTC (permalink / raw)
  To: xfs; +Cc: linux-api, linux-fsdevel, linux-ext4

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.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 include/uapi/linux/fsmap.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/fsmap.h b/include/uapi/linux/fsmap.h
index 7e8e5f0b..e5213c3 100644
--- a/include/uapi/linux/fsmap.h
+++ b/include/uapi/linux/fsmap.h
@@ -96,7 +96,7 @@ fsmap_advance(
 #define FMR_OF_EXTENT_MAP	0x4	/* segment = extent map */
 #define FMR_OF_SHARED		0x8	/* segment = shared with another file */
 #define FMR_OF_SPECIAL_OWNER	0x10	/* owner is a special value */
-#define FMR_OF_LAST		0x20	/* segment is the last in the FS */
+#define FMR_OF_LAST		0x20	/* segment is the last in the dataset */
 
 /* Each FS gets to define its own special owner codes. */
 #define FMR_OWNER(type, code)	(((__u64)type << 32) | \

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fsmap: fix documentation of FMR_OF_LAST
  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  8:09 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2017-09-01  0:30 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: xfs, linux-api-u79uwXL29TY76Z2rM5mHXA, linux-fsdevel, linux-ext4

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.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
>  include/uapi/linux/fsmap.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/fsmap.h b/include/uapi/linux/fsmap.h
> index 7e8e5f0b..e5213c3 100644
> --- a/include/uapi/linux/fsmap.h
> +++ b/include/uapi/linux/fsmap.h
> @@ -96,7 +96,7 @@ fsmap_advance(
>  #define FMR_OF_EXTENT_MAP	0x4	/* segment = extent map */
>  #define FMR_OF_SHARED		0x8	/* segment = shared with another file */
>  #define FMR_OF_SPECIAL_OWNER	0x10	/* owner is a special value */
> -#define FMR_OF_LAST		0x20	/* segment is the last in the FS */
> +#define FMR_OF_LAST		0x20	/* segment is the last in the dataset */
>  
>  /* Each FS gets to define its own special owner codes. */
>  #define FMR_OWNER(type, code)	(((__u64)type << 32) | \

Looks fine.

Reviewed-by: Dave Chinner <dchinner-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

-- 
Dave Chinner
david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fsmap: fix documentation of FMR_OF_LAST
  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  8:09 ` Christoph Hellwig
       [not found]   ` <20170901080904.GA32746-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-09-01  8:09 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: xfs, linux-api-u79uwXL29TY76Z2rM5mHXA, linux-fsdevel, linux-ext4

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fsmap: fix documentation of FMR_OF_LAST
       [not found]   ` <20170901080904.GA32746-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
@ 2017-09-01 15:07     ` Darrick J. Wong
  2017-09-03  8:41       ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2017-09-01 15:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: xfs, linux-api-u79uwXL29TY76Z2rM5mHXA, linux-fsdevel, linux-ext4

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fsmap: fix documentation of FMR_OF_LAST
  2017-09-01 15:07     ` Darrick J. Wong
@ 2017-09-03  8:41       ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2017-09-03  8:41 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Christoph Hellwig, xfs, linux-api, linux-fsdevel, linux-ext4

On Fri, Sep 01, 2017 at 08:07:16AM -0700, Darrick J. Wong wrote:
> 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.

Oh, ok - it had to look up this defintion of dataset first.  With
that the explanation makes total sense:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-03  8:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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  8:09 ` Christoph Hellwig
     [not found]   ` <20170901080904.GA32746-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-09-01 15:07     ` Darrick J. Wong
2017-09-03  8:41       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).