diff options
author | Radek Podgorny <radek@podgorny.cz> | 2022-08-27 00:56:48 +0200 |
---|---|---|
committer | Radek Podgorny <radek@podgorny.cz> | 2023-02-13 13:07:40 +0100 |
commit | 426e517d3e2f2357707394fd442aedba11ae76c6 (patch) | |
tree | 87dc9a9bd540a6c554db43e04d8e28b240ca824d | |
parent | 12baaf0bf8ab0f90930bb0ff06cc4458c3549971 (diff) | |
download | unionfs-fuse-git-426e517d3e2f2357707394fd442aedba11ae76c6.tar.gz |
add support for direct-io
-rw-r--r-- | src/fuse_ops.c | 11 | ||||
-rw-r--r-- | src/opts.c | 4 | ||||
-rw-r--r-- | src/opts.h | 4 | ||||
-rw-r--r-- | src/unionfs.c | 1 |
4 files changed, 18 insertions, 2 deletions
diff --git a/src/fuse_ops.c b/src/fuse_ops.c index 20d8cbb..bed5086 100644 --- a/src/fuse_ops.c +++ b/src/fuse_ops.c @@ -125,6 +125,10 @@ static int unionfs_create(const char *path, mode_t mode, struct fuse_file_info * // NOW, that the file has the proper owner we may set the requested mode fchmod(res, mode); + if (uopt.direct_io) { + fi->direct_io = 1; + } + fi->fh = res; remove_hidden(path, i); @@ -421,8 +425,13 @@ static int unionfs_open(const char *path, struct fuse_file_info *fi) { remove_hidden(path, i); } - // This makes exec() fail + // This makes exec() fail - wtf is this? obsolete? //fi->direct_io = 1; + + if (uopt.direct_io) { + fi->direct_io = 1; + } + fi->fh = (unsigned long)fd; DBG("fd = %"PRIx64"\n", fi->fh); @@ -292,6 +292,7 @@ static void print_help(const char *progname) { " -o relaxed_permissions Disable permissions checks, but only if\n" " running neither as UID=0 or GID=0\n" " -o statfs_omit_ro do not count blocks of ro-branches\n" + " -o direct_io Enable direct-io flag for fuse subsystem\n" "\n", progname); } @@ -394,6 +395,9 @@ int unionfs_opt_proc(void *data, const char *arg, int key, struct fuse_args *out case KEY_RELAXED_PERMISSIONS: uopt.relaxed_permissions = true; return 0; + case KEY_DIRECT_IO: + uopt.direct_io = true; + return 0; case KEY_VERSION: printf("unionfs-fuse version: "VERSION"\n"); #ifdef HAVE_XATTR @@ -31,6 +31,7 @@ typedef struct { pthread_rwlock_t dbgpath_lock; // locks dbgpath bool hide_meta_files; bool relaxed_permissions; + bool direct_io; } uopt_t; @@ -47,7 +48,8 @@ enum { KEY_NOINITGROUPS, KEY_RELAXED_PERMISSIONS, KEY_STATFS_OMIT_RO, - KEY_VERSION + KEY_DIRECT_IO, + KEY_VERSION, }; diff --git a/src/unionfs.c b/src/unionfs.c index 361784f..6949ba1 100644 --- a/src/unionfs.c +++ b/src/unionfs.c @@ -35,6 +35,7 @@ static struct fuse_opt unionfs_opts[] = { FUSE_OPT_KEY("noinitgroups", KEY_NOINITGROUPS), FUSE_OPT_KEY("relaxed_permissions", KEY_RELAXED_PERMISSIONS), FUSE_OPT_KEY("statfs_omit_ro", KEY_STATFS_OMIT_RO), + FUSE_OPT_KEY("direct_io", KEY_DIRECT_IO), FUSE_OPT_KEY("--version", KEY_VERSION), FUSE_OPT_KEY("-V", KEY_VERSION), FUSE_OPT_END |