From: Darrick J. Wong <djwong@xxxxxxxxxx> Set FUSE_IFLAG_* when we do a getattr, so that all files will have iomap enabled. Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> --- misc/fuse2fs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index c21a95b6920d5c..e71fcbaeeaf0c6 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -1571,6 +1571,25 @@ static int op_getattr(const char *path, struct stat *statbuf return ret; } +#ifdef HAVE_FUSE_IOMAP +static int op_getattr_iflags(const char *path, struct stat *statbuf, + unsigned int *iflags, struct fuse_file_info *fi) +{ + struct fuse_context *ctxt = fuse_get_context(); + struct fuse2fs *ff = (struct fuse2fs *)ctxt->private_data; + int ret = op_getattr(path, statbuf, fi); + + if (ret) + return ret; + + if (fuse2fs_iomap_does_fileio(ff)) + *iflags |= FUSE_IFLAG_IOMAP_DIRECTIO | FUSE_IFLAG_IOMAP_FILEIO; + + return 0; +} +#endif + + static int op_readlink(const char *path, char *buf, size_t len) { struct fuse_context *ctxt = fuse_get_context(); @@ -6178,6 +6197,7 @@ static struct fuse_operations fs_ops = { .iomap_end = op_iomap_end, .iomap_config = op_iomap_config, .iomap_ioend = op_iomap_ioend, + .getattr_iflags = op_getattr_iflags, #endif /* HAVE_FUSE_IOMAP */ };