mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
Rename kernel cache options
Thanks to @cipriancraciun for suggesting way better names
This commit is contained in:
parent
34b3de12c2
commit
70c2a97fdd
@ -64,25 +64,28 @@ options:
|
|||||||
will also consume more memory to hold the hardlink count table.
|
will also consume more memory to hold the hardlink count table.
|
||||||
This will be 4 bytes for every regular file inode.
|
This will be 4 bytes for every regular file inode.
|
||||||
|
|
||||||
* `-o no_image_madvise`
|
* `-o (no_)cache_image`
|
||||||
By default, `dwarfs` will issue `madvise` calls after reading
|
By default, `dwarfs` tries to ensure that the compressed file
|
||||||
the compressed block data from the file system image. This
|
system image will not be cached by the kernel (i.e. the default
|
||||||
will reduce the memory consumption of the FUSE driver to
|
is `-o no_cache_image`). This will reduce the memory consumption
|
||||||
slightly more than the `cachesize`. This usually isn't a
|
of the FUSE driver to slightly more than the `cachesize`, plus
|
||||||
problem, especially when the image is stored on an SSD, but if
|
the size of the metadata block. This usually isn't a problem,
|
||||||
you want to maximize performance it can be beneficial to use
|
especially when the image is stored on an SSD, but if you want
|
||||||
this option to keep the compressed image data in the kernel
|
to maximize performance it can be beneficial to use
|
||||||
|
`-o cache_image` to keep the compressed image data in the kernel
|
||||||
cache.
|
cache.
|
||||||
|
|
||||||
* `-o direct_io`
|
* `-o (no_)cache_files`
|
||||||
By default, files in the mounted file system will be cached by
|
By default, files in the mounted file system will be cached by
|
||||||
the kernel. This significantly improves performance when accessing
|
the kernel (i.e. the default is `-o cache_files`). This will
|
||||||
the same files over and over again, especially if the data from
|
significantly improve performance when accessing the same files
|
||||||
these files has been (partially) evicted from the block cache of
|
over and over again, especially if the data from these files has
|
||||||
`dwarfs`. By setting this option, you can force the fuse driver
|
been (partially) evicted from the block cache. By setting the
|
||||||
to not use the kernel cache for file data. If you're short on
|
`-o no_cache_files` option, you can force the fuse driver to not
|
||||||
memory and only infrequently accessing files, this can be worth
|
use the kernel cache for file data. If you're short on memory and
|
||||||
trying.
|
only infrequently accessing files, this can be worth trying, even
|
||||||
|
though it's likely that the kernel will already do the right thing
|
||||||
|
even when the cache is enabled.
|
||||||
|
|
||||||
* `-o debuglevel=`*name*:
|
* `-o debuglevel=`*name*:
|
||||||
Use this for different levels of verbosity along with either
|
Use this for different levels of verbosity along with either
|
||||||
|
@ -53,8 +53,8 @@ struct options {
|
|||||||
const char* mlock_str; // TODO: const?? -> use string?
|
const char* mlock_str; // TODO: const?? -> use string?
|
||||||
const char* decompress_ratio_str; // TODO: const?? -> use string?
|
const char* decompress_ratio_str; // TODO: const?? -> use string?
|
||||||
int enable_nlink;
|
int enable_nlink;
|
||||||
int no_image_madvise;
|
int cache_image;
|
||||||
int direct_io;
|
int cache_files;
|
||||||
size_t cachesize;
|
size_t cachesize;
|
||||||
size_t workers;
|
size_t workers;
|
||||||
mlock_mode lock_mode;
|
mlock_mode lock_mode;
|
||||||
@ -79,8 +79,10 @@ const struct fuse_opt dwarfs_opts[] = {
|
|||||||
DWARFS_OPT("mlock=%s", mlock_str, 0),
|
DWARFS_OPT("mlock=%s", mlock_str, 0),
|
||||||
DWARFS_OPT("decratio=%s", decompress_ratio_str, 0),
|
DWARFS_OPT("decratio=%s", decompress_ratio_str, 0),
|
||||||
DWARFS_OPT("enable_nlink", enable_nlink, 1),
|
DWARFS_OPT("enable_nlink", enable_nlink, 1),
|
||||||
DWARFS_OPT("no_image_madvise", no_image_madvise, 1),
|
DWARFS_OPT("cache_image", cache_image, 1),
|
||||||
DWARFS_OPT("direct_io", direct_io, 1),
|
DWARFS_OPT("no_cache_image", cache_image, 0),
|
||||||
|
DWARFS_OPT("cache_files", cache_files, 1),
|
||||||
|
DWARFS_OPT("no_cache_files", cache_files, 0),
|
||||||
FUSE_OPT_END};
|
FUSE_OPT_END};
|
||||||
|
|
||||||
options s_opts;
|
options s_opts;
|
||||||
@ -101,7 +103,7 @@ void op_init(void* /*userdata*/, struct fuse_conn_info* /*conn*/) {
|
|||||||
fsopts.block_cache.max_bytes = s_opts.cachesize;
|
fsopts.block_cache.max_bytes = s_opts.cachesize;
|
||||||
fsopts.block_cache.num_workers = s_opts.workers;
|
fsopts.block_cache.num_workers = s_opts.workers;
|
||||||
fsopts.block_cache.decompress_ratio = s_opts.decompress_ratio;
|
fsopts.block_cache.decompress_ratio = s_opts.decompress_ratio;
|
||||||
fsopts.block_cache.mm_release = !s_opts.no_image_madvise;
|
fsopts.block_cache.mm_release = !s_opts.cache_image;
|
||||||
fsopts.metadata.enable_nlink = bool(s_opts.enable_nlink);
|
fsopts.metadata.enable_nlink = bool(s_opts.enable_nlink);
|
||||||
s_fs = std::make_shared<filesystem_v2>(
|
s_fs = std::make_shared<filesystem_v2>(
|
||||||
s_lgr, std::make_shared<mmap>(s_opts.fsimage), fsopts,
|
s_lgr, std::make_shared<mmap>(s_opts.fsimage), fsopts,
|
||||||
@ -254,8 +256,8 @@ void op_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) {
|
|||||||
err = EACCES;
|
err = EACCES;
|
||||||
} else {
|
} else {
|
||||||
fi->fh = FUSE_ROOT_ID + entry->inode();
|
fi->fh = FUSE_ROOT_ID + entry->inode();
|
||||||
fi->direct_io = s_opts.direct_io;
|
fi->direct_io = !s_opts.cache_files;
|
||||||
fi->keep_cache = !s_opts.direct_io;
|
fi->keep_cache = s_opts.cache_files;
|
||||||
fuse_reply_open(req, fi);
|
fuse_reply_open(req, fi);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -398,8 +400,8 @@ void usage(const char* progname) {
|
|||||||
<< " -o mlock=NAME mlock mode: (none), try, must\n"
|
<< " -o mlock=NAME mlock mode: (none), try, must\n"
|
||||||
<< " -o decratio=NUM ratio for full decompression (0.8)\n"
|
<< " -o decratio=NUM ratio for full decompression (0.8)\n"
|
||||||
<< " -o enable_nlink show correct hardlink numbers\n"
|
<< " -o enable_nlink show correct hardlink numbers\n"
|
||||||
<< " -o no_image_madvise keep image in kernel cache\n"
|
<< " -o (no_)cache_image (don't) keep image in kernel cache\n"
|
||||||
<< " -o direct_io don't keep files in kernel cache\n"
|
<< " -o (no_)cache_files (don't) keep files in kernel cache\n"
|
||||||
<< " -o debuglevel=NAME error, warn, (info), debug, trace\n"
|
<< " -o debuglevel=NAME error, warn, (info), debug, trace\n"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
@ -498,6 +500,8 @@ int main(int argc, char* argv[]) {
|
|||||||
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
|
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
|
||||||
|
|
||||||
s_opts.progname = argv[0];
|
s_opts.progname = argv[0];
|
||||||
|
s_opts.cache_image = 0;
|
||||||
|
s_opts.cache_files = 1;
|
||||||
|
|
||||||
fuse_opt_parse(&args, &s_opts, dwarfs_opts, option_hdl);
|
fuse_opt_parse(&args, &s_opts, dwarfs_opts, option_hdl);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user