Add extent flag to indicate that the data are compressed. The users set the fe_phys_length member, and PHYS_LENGTH and ENCODED flags. Signed-off-by: David Sterba <dsterba@xxxxxxx> --- fs/ioctl.c | 6 +++++- include/uapi/linux/fiemap.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ioctl.c b/fs/ioctl.c index 127551c70b0a..902b1d5a6316 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -81,7 +81,8 @@ static int ioctl_fibmap(struct file *filp, int __user *p) * extent that will fit in user array. */ #define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC) -#define SET_NO_UNMOUNTED_IO_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED) +#define SET_NO_UNMOUNTED_IO_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED | \ + FIEMAP_EXTENT_DATA_COMPRESSED) #define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE) int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical, u64 phys, u64 len, u64 phys_len, u32 flags) @@ -112,6 +113,9 @@ int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical, extent.fe_flags = flags; extent.fe_phys_length = phys_len; + WARN_ON_ONCE((flags & FIEMAP_EXTENT_DATA_COMPRESSED) + && !(flags & FIEMAP_EXTENT_ENCODED)); + dest += fieinfo->fi_extents_mapped; if (copy_to_user(dest, &extent, sizeof(extent))) return -EFAULT; diff --git a/include/uapi/linux/fiemap.h b/include/uapi/linux/fiemap.h index ed52d3f7821d..64fb1b3a7e1f 100644 --- a/include/uapi/linux/fiemap.h +++ b/include/uapi/linux/fiemap.h @@ -54,6 +54,10 @@ struct fiemap { * while fs is unmounted */ #define FIEMAP_EXTENT_PHYS_LENGTH 0x00000010 /* Physical length of extent * not the same as logical */ +#define FIEMAP_EXTENT_DATA_COMPRESSED 0x00000040 /* Data is compressed by fs. + * Sets EXTENT_ENCODED and + * the compressed size is + * stored in fe_phys_length */ #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. * Sets EXTENT_ENCODED */ #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html