* [PATCH] iomap: don't set FIEMAP_EXTENT_MERGED for extent based filesystems
@ 2016-08-21 21:47 Christoph Hellwig
2016-08-23 1:27 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2016-08-21 21:47 UTC (permalink / raw)
To: xfs; +Cc: agruenba, rpeterso, linux-fsdevel
Filesystems like XFS that use extents should not set the
FIEMAP_EXTENT_MERGED flag in the fiemap extent structures. To allow
for both behaviors for the upcoming gfs2 usage split the iomap
type field into type and flags, and only set FIEMAP_EXTENT_MERGED if
the IOMAP_F_MERGED flag is set. The flags field will also come in
handy for future features such as shared extents on reflink-enabled
file systems.
Reported-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/iomap.c | 5 ++++-
include/linux/iomap.h | 8 +++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/fs/iomap.c b/fs/iomap.c
index 0342254..706270f 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -428,9 +428,12 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi,
break;
}
+ if (iomap->flags & IOMAP_F_MERGED)
+ flags |= FIEMAP_EXTENT_MERGED;
+
return fiemap_fill_next_extent(fi, iomap->offset,
iomap->blkno != IOMAP_NULL_BLOCK ? iomap->blkno << 9: 0,
- iomap->length, flags | FIEMAP_EXTENT_MERGED);
+ iomap->length, flags);
}
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 3267df4..3d70ece 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -19,6 +19,11 @@ struct vm_fault;
#define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */
/*
+ * Flags for iomap mappings:
+ */
+#define IOMAP_F_MERGED 0x01 /* contains multiple blocks/extents */
+
+/*
* Magic value for blkno:
*/
#define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */
@@ -27,7 +32,8 @@ struct iomap {
sector_t blkno; /* 1st sector of mapping, 512b units */
loff_t offset; /* file offset of mapping, bytes */
u64 length; /* length of mapping, bytes */
- int type; /* type of mapping */
+ u16 type; /* type of mapping */
+ u16 flags; /* flags for mapping */
struct block_device *bdev; /* block device for I/O */
};
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iomap: don't set FIEMAP_EXTENT_MERGED for extent based filesystems
2016-08-21 21:47 [PATCH] iomap: don't set FIEMAP_EXTENT_MERGED for extent based filesystems Christoph Hellwig
@ 2016-08-23 1:27 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2016-08-23 1:27 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs, rpeterso, linux-fsdevel, agruenba
On Sun, Aug 21, 2016 at 11:47:03PM +0200, Christoph Hellwig wrote:
> Filesystems like XFS that use extents should not set the
> FIEMAP_EXTENT_MERGED flag in the fiemap extent structures. To allow
> for both behaviors for the upcoming gfs2 usage split the iomap
> type field into type and flags, and only set FIEMAP_EXTENT_MERGED if
> the IOMAP_F_MERGED flag is set. The flags field will also come in
> handy for future features such as shared extents on reflink-enabled
> file systems.
You can add an:
Acked-by: Darrick J. Wong <darrick.wong@oracle.com>
I'm going to send in a similar patch adding a SHARED flag when I
send out the XFS reflink series for review later this week.
--D
>
> Reported-by: Andreas Gruenbacher <agruenba@redhat.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/iomap.c | 5 ++++-
> include/linux/iomap.h | 8 +++++++-
> 2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/fs/iomap.c b/fs/iomap.c
> index 0342254..706270f 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -428,9 +428,12 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi,
> break;
> }
>
> + if (iomap->flags & IOMAP_F_MERGED)
> + flags |= FIEMAP_EXTENT_MERGED;
> +
> return fiemap_fill_next_extent(fi, iomap->offset,
> iomap->blkno != IOMAP_NULL_BLOCK ? iomap->blkno << 9: 0,
> - iomap->length, flags | FIEMAP_EXTENT_MERGED);
> + iomap->length, flags);
>
> }
>
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 3267df4..3d70ece 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -19,6 +19,11 @@ struct vm_fault;
> #define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */
>
> /*
> + * Flags for iomap mappings:
> + */
> +#define IOMAP_F_MERGED 0x01 /* contains multiple blocks/extents */
> +
> +/*
> * Magic value for blkno:
> */
> #define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */
> @@ -27,7 +32,8 @@ struct iomap {
> sector_t blkno; /* 1st sector of mapping, 512b units */
> loff_t offset; /* file offset of mapping, bytes */
> u64 length; /* length of mapping, bytes */
> - int type; /* type of mapping */
> + u16 type; /* type of mapping */
> + u16 flags; /* flags for mapping */
> struct block_device *bdev; /* block device for I/O */
> };
>
> --
> 2.1.4
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-23 1:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-21 21:47 [PATCH] iomap: don't set FIEMAP_EXTENT_MERGED for extent based filesystems Christoph Hellwig
2016-08-23 1:27 ` Darrick J. Wong
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).