aboutsummaryrefslogtreecommitdiffstats
path: root/example/passthrough_fh.c
diff options
context:
space:
mode:
authoryangyun <yangyun50@huawei.com>2024-02-23 11:06:08 +0800
committeryangyun <yangyun50@huawei.com>2024-02-23 15:01:29 +0800
commitfce970c313bf25ba9ae5b6a335e3293736df3d48 (patch)
treee38ec6d010af8c954e7c954c5fcf0e2ff6470800 /example/passthrough_fh.c
parent402c8fff588120a7cf5922822904ce45f30612a8 (diff)
downloadlibfuse-fce970c313bf25ba9ae5b6a335e3293736df3d48.tar.gz
passthrough_example: make parallel_direct_writes more clearly
Move the parallel_direct_writes enable action to the init function in high level API, it is more recommended just like commit 8ee553dac. Besides, add some comments to show that the feature parallel_direct_writes is depend on the feature direct_io (refer to kernel side patch series to consolidate direct IO, link: https://lwn.net/ml/linux-fsdevel/ 20230918150313.3845114-1-bschubert@ddn.com for the reason).
Diffstat (limited to 'example/passthrough_fh.c')
-rw-r--r--example/passthrough_fh.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/example/passthrough_fh.c b/example/passthrough_fh.c
index 51df3be..ec426a8 100644
--- a/example/passthrough_fh.c
+++ b/example/passthrough_fh.c
@@ -54,6 +54,13 @@ static void *xmp_init(struct fuse_conn_info *conn,
cfg->use_ino = 1;
cfg->nullpath_ok = 1;
+ /* parallel_direct_writes feature depends on direct_io features.
+ To make parallel_direct_writes valid, need either set cfg->direct_io
+ in current function (recommended in high level API) or set fi->direct_io
+ in xmp_create() or xmp_open(). */
+ // cfg->direct_io = 1;
+ cfg->parallel_direct_writes = 1;
+
/* Pick up changes from lower filesystem right away. This is
also necessary for better hardlink support. When the kernel
calls the unlink() handler, it does not know the inode of
@@ -366,7 +373,6 @@ static int xmp_create(const char *path, mode_t mode, struct fuse_file_info *fi)
return -errno;
fi->fh = fd;
- fi->parallel_direct_writes = 1;
return 0;
}
@@ -379,7 +385,6 @@ static int xmp_open(const char *path, struct fuse_file_info *fi)
return -errno;
fi->fh = fd;
- fi->parallel_direct_writes = 1;
return 0;
}