From: Darrick J. Wong <djwong@xxxxxxxxxx> Implement file reads via iomap. Currently only directio is supported. Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> --- misc/fuse2fs.c | 14 +++++++++++++- misc/fuse4fs.c | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 8bf0fbcff093a7..1dda9c45cb5089 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -5359,7 +5359,19 @@ static int fuse2fs_iomap_begin_read(struct fuse2fs *ff, ext2_ino_t ino, uint64_t count, uint32_t opflags, struct fuse_file_iomap *read) { - return -ENOSYS; + if (!(opflags & FUSE_IOMAP_OP_DIRECT)) + return -ENOSYS; + + /* fall back to slow path for inline data reads */ + if (inode->i_flags & EXT4_INLINE_DATA_FL) + return -ENOSYS; + + if (inode->i_flags & EXT4_EXTENTS_FL) + return fuse2fs_iomap_begin_extent(ff, ino, inode, pos, count, + opflags, read); + + return fuse2fs_iomap_begin_indirect(ff, ino, inode, pos, count, + opflags, read); } static int fuse2fs_iomap_begin_write(struct fuse2fs *ff, ext2_ino_t ino, diff --git a/misc/fuse4fs.c b/misc/fuse4fs.c index 5debaf892b2113..2aa7ab646592e9 100644 --- a/misc/fuse4fs.c +++ b/misc/fuse4fs.c @@ -5767,7 +5767,19 @@ static int fuse4fs_iomap_begin_read(struct fuse4fs *ff, ext2_ino_t ino, uint64_t count, uint32_t opflags, struct fuse_file_iomap *read) { - return -ENOSYS; + if (!(opflags & FUSE_IOMAP_OP_DIRECT)) + return -ENOSYS; + + /* fall back to slow path for inline data reads */ + if (inode->i_flags & EXT4_INLINE_DATA_FL) + return -ENOSYS; + + if (inode->i_flags & EXT4_EXTENTS_FL) + return fuse4fs_iomap_begin_extent(ff, ino, inode, pos, count, + opflags, read); + + return fuse4fs_iomap_begin_indirect(ff, ino, inode, pos, count, + opflags, read); } static int fuse4fs_iomap_begin_write(struct fuse4fs *ff, ext2_ino_t ino,