mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-13 06:16:55 -04:00
Add direct_io
option
This commit is contained in:
parent
8af78e5062
commit
915a75eacb
@ -74,6 +74,16 @@ options:
|
||||
this option to keep the compressed image data in the kernel
|
||||
cache.
|
||||
|
||||
* `-o direct_io`
|
||||
By default, files in the mounted file system will be cached by
|
||||
the kernel. This significantly improves performance when accessing
|
||||
the same files over and over again, especially if the data from
|
||||
these files has been (partially) evicted from the block cache of
|
||||
`dwarfs`. By setting this option, you can force the fuse driver
|
||||
to not use the kernel cache for file data. If you're short on
|
||||
memory and only infrequently accessing files, this can be worth
|
||||
trying.
|
||||
|
||||
* `-o debuglevel=`*name*:
|
||||
Use this for different levels of verbosity along with either
|
||||
the `-f` or `-d` FUSE options. This can give you some insight
|
||||
|
@ -54,6 +54,7 @@ struct options {
|
||||
const char* decompress_ratio_str; // TODO: const?? -> use string?
|
||||
int enable_nlink;
|
||||
int no_image_madvise;
|
||||
int direct_io;
|
||||
size_t cachesize;
|
||||
size_t workers;
|
||||
mlock_mode lock_mode;
|
||||
@ -79,6 +80,7 @@ const struct fuse_opt dwarfs_opts[] = {
|
||||
DWARFS_OPT("decratio=%s", decompress_ratio_str, 0),
|
||||
DWARFS_OPT("enable_nlink", enable_nlink, 1),
|
||||
DWARFS_OPT("no_image_madvise", no_image_madvise, 1),
|
||||
DWARFS_OPT("direct_io", direct_io, 1),
|
||||
FUSE_OPT_END};
|
||||
|
||||
options s_opts;
|
||||
@ -252,7 +254,8 @@ void op_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) {
|
||||
err = EACCES;
|
||||
} else {
|
||||
fi->fh = FUSE_ROOT_ID + entry->inode();
|
||||
fi->keep_cache = 1;
|
||||
fi->direct_io = s_opts.direct_io;
|
||||
fi->keep_cache = !s_opts.direct_io;
|
||||
fuse_reply_open(req, fi);
|
||||
return;
|
||||
}
|
||||
@ -396,6 +399,7 @@ void usage(const char* progname) {
|
||||
<< " -o decratio=NUM ratio for full decompression (0.8)\n"
|
||||
<< " -o enable_nlink show correct hardlink numbers\n"
|
||||
<< " -o no_image_madvise keep image in kernel cache\n"
|
||||
<< " -o direct_io don't keep files in kernel cache\n"
|
||||
<< " -o debuglevel=NAME error, warn, (info), debug, trace\n"
|
||||
<< std::endl;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user