From: Darrick J. Wong <djwong@xxxxxxxxxx> In iomap mode, we can support the strictatime/lazytime mount options. Add them to fuse2fs. Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> --- misc/fuse2fs.c | 28 ++++++++++++++++++++++++++++ misc/fuse4fs.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 291416afb93d6c..9ac9077f3508f7 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -267,6 +267,7 @@ struct fuse2fs { uint8_t dirsync; uint8_t unmount_in_destroy; uint8_t noblkdev; + uint8_t iomap_passthrough_options; enum fuse2fs_opstate opstate; int logfd; @@ -1422,6 +1423,8 @@ static void fuse2fs_iomap_enable(struct fuse_conn_info *conn, if (!fuse2fs_iomap_enabled(ff)) { if (ff->iomap_want == FT_ENABLE) err_printf(ff, "%s\n", _("Could not enable iomap.")); + if (ff->iomap_passthrough_options) + err_printf(ff, "%s\n", _("Some mount options require iomap.")); return; } } @@ -6394,6 +6397,7 @@ enum { FUSE2FS_ERRORS_BEHAVIOR, #ifdef HAVE_FUSE_IOMAP FUSE2FS_IOMAP, + FUSE2FS_IOMAP_PASSTHROUGH, #endif }; @@ -6420,6 +6424,17 @@ static struct fuse_opt fuse2fs_opts[] = { #endif FUSE2FS_OPT("noblkdev", noblkdev, 1), +#ifdef HAVE_FUSE_IOMAP +#ifdef MS_LAZYTIME + FUSE_OPT_KEY("lazytime", FUSE2FS_IOMAP_PASSTHROUGH), + FUSE_OPT_KEY("nolazytime", FUSE2FS_IOMAP_PASSTHROUGH), +#endif +#ifdef MS_STRICTATIME + FUSE_OPT_KEY("strictatime", FUSE2FS_IOMAP_PASSTHROUGH), + FUSE_OPT_KEY("nostrictatime", FUSE2FS_IOMAP_PASSTHROUGH), +#endif +#endif + FUSE_OPT_KEY("user_xattr", FUSE2FS_IGNORED), FUSE_OPT_KEY("noblock_validity", FUSE2FS_IGNORED), FUSE_OPT_KEY("nodelalloc", FUSE2FS_IGNORED), @@ -6446,6 +6461,12 @@ static int fuse2fs_opt_proc(void *data, const char *arg, struct fuse2fs *ff = data; switch (key) { +#ifdef HAVE_FUSE_IOMAP + case FUSE2FS_IOMAP_PASSTHROUGH: + ff->iomap_passthrough_options = 1; + /* pass through to libfuse */ + return 1; +#endif case FUSE2FS_DIRSYNC: ff->dirsync = 1; /* pass through to libfuse */ @@ -6735,6 +6756,13 @@ int main(int argc, char *argv[]) fctx.unmount_in_destroy = 1; } + if (fctx.iomap_passthrough_options && !iomap_detected) { + err_printf(&fctx, "%s\n", + _("Some mount options require iomap.")); + ret |= 1; + goto out; + } + if (!fctx.cache_size) fctx.cache_size = default_cache_size(); if (fctx.cache_size) { diff --git a/misc/fuse4fs.c b/misc/fuse4fs.c index 37a7ab3a3718e4..1050238c88632d 100644 --- a/misc/fuse4fs.c +++ b/misc/fuse4fs.c @@ -262,6 +262,7 @@ struct fuse4fs { uint8_t dirsync; uint8_t unmount_in_destroy; uint8_t noblkdev; + uint8_t iomap_passthrough_options; enum fuse4fs_opstate opstate; int logfd; @@ -1603,6 +1604,8 @@ static void fuse4fs_iomap_enable(struct fuse_conn_info *conn, if (!fuse4fs_iomap_enabled(ff)) { if (ff->iomap_want == FT_ENABLE) err_printf(ff, "%s\n", _("Could not enable iomap.")); + if (ff->iomap_passthrough_options) + err_printf(ff, "%s\n", _("Some mount options require iomap.")); return; } } @@ -6697,6 +6700,7 @@ enum { FUSE4FS_ERRORS_BEHAVIOR, #ifdef HAVE_FUSE_IOMAP FUSE4FS_IOMAP, + FUSE4FS_IOMAP_PASSTHROUGH, #endif }; @@ -6723,6 +6727,17 @@ static struct fuse_opt fuse4fs_opts[] = { #endif FUSE4FS_OPT("noblkdev", noblkdev, 1), +#ifdef HAVE_FUSE_IOMAP +#ifdef MS_LAZYTIME + FUSE_OPT_KEY("lazytime", FUSE4FS_IOMAP_PASSTHROUGH), + FUSE_OPT_KEY("nolazytime", FUSE4FS_IOMAP_PASSTHROUGH), +#endif +#ifdef MS_STRICTATIME + FUSE_OPT_KEY("strictatime", FUSE4FS_IOMAP_PASSTHROUGH), + FUSE_OPT_KEY("nostrictatime", FUSE4FS_IOMAP_PASSTHROUGH), +#endif +#endif + FUSE_OPT_KEY("user_xattr", FUSE4FS_IGNORED), FUSE_OPT_KEY("noblock_validity", FUSE4FS_IGNORED), FUSE_OPT_KEY("nodelalloc", FUSE4FS_IGNORED), @@ -6749,6 +6764,12 @@ static int fuse4fs_opt_proc(void *data, const char *arg, struct fuse4fs *ff = data; switch (key) { +#ifdef HAVE_FUSE_IOMAP + case FUSE4FS_IOMAP_PASSTHROUGH: + ff->iomap_passthrough_options = 1; + /* pass through to libfuse */ + return 1; +#endif case FUSE4FS_DIRSYNC: ff->dirsync = 1; /* pass through to libfuse */ @@ -7137,6 +7158,13 @@ int main(int argc, char *argv[]) fctx.unmount_in_destroy = 1; } + if (fctx.iomap_passthrough_options && !iomap_detected) { + err_printf(&fctx, "%s\n", + _("Some mount options require iomap.")); + ret |= 1; + goto out; + } + if (!fctx.cache_size) fctx.cache_size = default_cache_size(); if (fctx.cache_size) {