diff options
author | Christoph Hellwig <hch@lst.de> | 2016-08-28 21:33:58 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-08-28 21:33:58 -0400 |
commit | 17de0a9ff3df8f54f2f47746d118112d4e61d973 (patch) | |
tree | b097752623a7a6a8e1be1540a52a6eb376da76eb | |
parent | 800b2694f890cc35a1bda63501fc71c94389d517 (diff) |
iomap: don't set FIEMAP_EXTENT_MERGED for extent based filesystems
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>
Acked-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/iomap.c | 5 | ||||
-rw-r--r-- | include/linux/iomap.h | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/fs/iomap.c b/fs/iomap.c index 0342254646e3..706270f21b35 100644 --- a/fs/iomap.c +++ b/fs/iomap.c | |||
@@ -428,9 +428,12 @@ static int iomap_to_fiemap(struct fiemap_extent_info *fi, | |||
428 | break; | 428 | break; |
429 | } | 429 | } |
430 | 430 | ||
431 | if (iomap->flags & IOMAP_F_MERGED) | ||
432 | flags |= FIEMAP_EXTENT_MERGED; | ||
433 | |||
431 | return fiemap_fill_next_extent(fi, iomap->offset, | 434 | return fiemap_fill_next_extent(fi, iomap->offset, |
432 | iomap->blkno != IOMAP_NULL_BLOCK ? iomap->blkno << 9: 0, | 435 | iomap->blkno != IOMAP_NULL_BLOCK ? iomap->blkno << 9: 0, |
433 | iomap->length, flags | FIEMAP_EXTENT_MERGED); | 436 | iomap->length, flags); |
434 | 437 | ||
435 | } | 438 | } |
436 | 439 | ||
diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 3267df461012..3d70ece10313 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h | |||
@@ -19,6 +19,11 @@ struct vm_fault; | |||
19 | #define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */ | 19 | #define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * Flags for iomap mappings: | ||
23 | */ | ||
24 | #define IOMAP_F_MERGED 0x01 /* contains multiple blocks/extents */ | ||
25 | |||
26 | /* | ||
22 | * Magic value for blkno: | 27 | * Magic value for blkno: |
23 | */ | 28 | */ |
24 | #define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */ | 29 | #define IOMAP_NULL_BLOCK -1LL /* blkno is not valid */ |
@@ -27,7 +32,8 @@ struct iomap { | |||
27 | sector_t blkno; /* 1st sector of mapping, 512b units */ | 32 | sector_t blkno; /* 1st sector of mapping, 512b units */ |
28 | loff_t offset; /* file offset of mapping, bytes */ | 33 | loff_t offset; /* file offset of mapping, bytes */ |
29 | u64 length; /* length of mapping, bytes */ | 34 | u64 length; /* length of mapping, bytes */ |
30 | int type; /* type of mapping */ | 35 | u16 type; /* type of mapping */ |
36 | u16 flags; /* flags for mapping */ | ||
31 | struct block_device *bdev; /* block device for I/O */ | 37 | struct block_device *bdev; /* block device for I/O */ |
32 | }; | 38 | }; |
33 | 39 | ||