[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174553065581.1161238.969038742323698265.stgit@frogsfrogsfrogs>
Date: Thu, 24 Apr 2025 14:46:33 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 4/5] fuse2fs: allow use of direct io for disk access
From: Darrick J. Wong <djwong@...nel.org>
Allow users to ask for O_DIRECT for disk accesses so that block device
writes won't be throttled. This should improve latency, but will put
a lot more pressure on the disk cache.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.1.in | 3 +++
misc/fuse2fs.c | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/misc/fuse2fs.1.in b/misc/fuse2fs.1.in
index 517c67ff719911..43678a1c1971c5 100644
--- a/misc/fuse2fs.1.in
+++ b/misc/fuse2fs.1.in
@@ -62,6 +62,9 @@ .SS "fuse2fs options:"
Note that these options can still be overridden (e.g.
.I nosuid
) later.
+.TP
+.BR -o direct
+Use O_DIRECT to access the block device.
.SS "FUSE options:"
.TP
\fB-d -o\fR debug
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 7f1e7556b9204e..6aac84a2b4340b 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -158,6 +158,7 @@ struct fuse2fs {
int alloc_all_blocks;
int norecovery;
int kernel;
+ int directio;
unsigned long offset;
unsigned int next_generation;
};
@@ -3776,6 +3777,7 @@ static struct fuse_opt fuse2fs_opts[] = {
FUSE2FS_OPT("noload", norecovery, 1),
FUSE2FS_OPT("offset=%lu", offset, 0),
FUSE2FS_OPT("kernel", kernel, 1),
+ FUSE2FS_OPT("directio", directio, 1),
FUSE_OPT_KEY("acl", FUSE2FS_IGNORED),
FUSE_OPT_KEY("user_xattr", FUSE2FS_IGNORED),
@@ -3824,6 +3826,7 @@ static int fuse2fs_opt_proc(void *data, const char *arg,
" -o fuse2fs_debug enable fuse2fs debugging\n"
" -o kernel run this as if it were the kernel, which sets:\n"
" allow_others,default_permissions,suid,dev\n"
+ " -o directio use O_DIRECT to read and write the disk\n"
"\n",
outargs->argv[0]);
if (key == FUSE2FS_HELPFULL) {
@@ -3929,6 +3932,8 @@ int main(int argc, char *argv[])
ret = 2;
char options[50];
sprintf(options, "offset=%lu", fctx.offset);
+ if (fctx.directio)
+ flags |= EXT2_FLAG_DIRECT_IO;
err = ext2fs_open2(fctx.device, options, flags, 0, 0, unix_io_manager,
&global_fs);
if (err) {
Powered by blists - more mailing lists