Re: [PATCH 3/4] ext4: Add iomap support for inline data

Jan Kara
2017-08-30T13:03:33Z

On Tue 29-08-17 16:29:41, Andreas Gruenbacher wrote:
> Report inline data as an IOMAP_F_DATA_INLINE mapping. This allows to
> switch to iomap_seek_hole and iomap_seek_data in ext4_llseek, and will
> make switching to iomap_fiemap in ext4_fiemap easier as well.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>

...

> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 429f0afde9f2..ab6ab835255e 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3411,8 +3411,14 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
> struct ext4_map_blocks map;
> int ret;
>
> - if (WARN_ON_ONCE(ext4_has_inline_data(inode)))
> - return -ERANGE;
> + if ((flags & IOMAP_REPORT) && ext4_has_inline_data(inode)) {
> + ret = ext4_inline_data_iomap(inode, iomap);
> + if (ret != -ENOENT) {
> + if (ret == 0 && offset >= iomap->length)
> + ret = -ENOENT;
> + return ret;
> + }
> + }

One more thing: Please keep that WARN_ON and bail out for !IOMAP_REPORT
cases. Thanks!

Honza

--
Jan Kara <jack@suse.com>
SUSE Labs, CR