Commit d33fd776 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

iomap: add IOMAP_REPORT

This allows the file system to tell a FIEMAP from a read operation, and thus
avoids the need to report flags that aren't actually used in the read path.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 5faaf4fa
...@@ -561,7 +561,7 @@ int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fi, ...@@ -561,7 +561,7 @@ int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fi,
} }
while (len > 0) { while (len > 0) {
ret = iomap_apply(inode, start, len, 0, ops, &ctx, ret = iomap_apply(inode, start, len, IOMAP_REPORT, ops, &ctx,
iomap_fiemap_actor); iomap_fiemap_actor);
/* inode with no (attribute) mapping will give ENOENT */ /* inode with no (attribute) mapping will give ENOENT */
if (ret == -ENOENT) if (ret == -ENOENT)
......
...@@ -19,11 +19,15 @@ struct vm_fault; ...@@ -19,11 +19,15 @@ struct vm_fault;
#define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */ #define IOMAP_UNWRITTEN 0x04 /* blocks allocated @blkno in unwritten state */
/* /*
* Flags for iomap mappings: * Flags for all iomap mappings:
*/ */
#define IOMAP_F_MERGED 0x01 /* contains multiple blocks/extents */ #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */
#define IOMAP_F_SHARED 0x02 /* block shared with another file */
#define IOMAP_F_NEW 0x04 /* blocks have been newly allocated */ /*
* Flags that only need to be reported for IOMAP_REPORT requests:
*/
#define IOMAP_F_MERGED 0x10 /* contains multiple blocks/extents */
#define IOMAP_F_SHARED 0x20 /* block shared with another file */
/* /*
* Magic value for blkno: * Magic value for blkno:
...@@ -42,8 +46,9 @@ struct iomap { ...@@ -42,8 +46,9 @@ struct iomap {
/* /*
* Flags for iomap_begin / iomap_end. No flag implies a read. * Flags for iomap_begin / iomap_end. No flag implies a read.
*/ */
#define IOMAP_WRITE (1 << 0) #define IOMAP_WRITE (1 << 0) /* writing, must allocate blocks */
#define IOMAP_ZERO (1 << 1) #define IOMAP_ZERO (1 << 1) /* zeroing operation, may skip holes */
#define IOMAP_REPORT (1 << 2) /* report extent status, e.g. FIEMAP */
struct iomap_ops { struct iomap_ops {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment