summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadek Podgorny <radek@podgorny.cz>2022-08-27 00:56:48 +0200
committerRadek Podgorny <radek@podgorny.cz>2023-02-13 13:07:40 +0100
commit426e517d3e2f2357707394fd442aedba11ae76c6 (patch)
tree87dc9a9bd540a6c554db43e04d8e28b240ca824d
parent12baaf0bf8ab0f90930bb0ff06cc4458c3549971 (diff)
downloadunionfs-fuse-git-426e517d3e2f2357707394fd442aedba11ae76c6.tar.gz
add support for direct-io
-rw-r--r--src/fuse_ops.c11
-rw-r--r--src/opts.c4
-rw-r--r--src/opts.h4
-rw-r--r--src/unionfs.c1
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);
diff --git a/src/opts.c b/src/opts.c
index 6b444f6..f8680b7 100644
--- a/src/opts.c
+++ b/src/opts.c
@@ -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
diff --git a/src/opts.h b/src/opts.h
index 0ee2d08..ab0814e 100644
--- a/src/opts.h
+++ b/src/opts.h
@@ -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