From 8dbc5c9d1c4db88f923ca2ada6a0e425c3d33b95 Mon Sep 17 00:00:00 2001 From: huanwen ren Date: Tue, 13 Mar 2018 10:35:10 +0800 Subject: [PATCH] client: add the fuse parameter max_write This parameter has the following 2 advantages: 1. FUSE(version > 2.8) the default single IO write size is 128k (controlled by max_write), if I use bs=4M in the FIO tool test, you will find that 4*1024k/128=32 is needed, ie 32 IO operations are needed . If I adjust max_write to 4M, only one operation is needed, which greatly improves the write performance of cephfs during fuse mount. Of course, the above implementation requires libfuse and kernel fuse to support. 2. In addition, we can also limit the single IO write size by setting max_write to less than 128K. Signed-off-by: huanwen ren --- doc/cephfs/client-config-ref.rst | 6 ++++++ src/client/fuse_ll.cc | 9 +++++++++ src/common/options.cc | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/doc/cephfs/client-config-ref.rst b/doc/cephfs/client-config-ref.rst index da462486ad4fb..931756446e50e 100644 --- a/doc/cephfs/client-config-ref.rst +++ b/doc/cephfs/client-config-ref.rst @@ -177,6 +177,12 @@ :Type: Boolean :Default: ``true`` +``fuse max write`` + +:Description: Set the maximum number of bytes in a single write operation. Because the FUSE default is 128kbytes, SO fuse_max_write default set to 0(The default does not take effect) +:Type: Integer +:Default: ``0`` + Developer Options ################# diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 49597b7bb32ea..353782a89672c 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -1095,6 +1095,8 @@ int CephFuse::Handle::init(int argc, const char *argv[]) "fuse_atomic_o_trunc"); auto fuse_debug = client->cct->_conf->get_val( "fuse_debug"); + auto fuse_max_write = client->cct->_conf->get_val( + "fuse_max_write"); if (fuse_allow_other) { newargv[newargc++] = "-o"; @@ -1109,6 +1111,13 @@ int CephFuse::Handle::init(int argc, const char *argv[]) newargv[newargc++] = "-o"; newargv[newargc++] = "big_writes"; } + if (fuse_max_write > 0) { + char strsplice[65]; + newargv[newargc++] = "-o"; + newargv[newargc++] = strsplice; + sprintf(strsplice, "max_write=%" PRIu64, fuse_max_write); + newargv[newargc++] = strsplice; + } if (fuse_atomic_o_trunc) { newargv[newargc++] = "-o"; newargv[newargc++] = "atomic_o_trunc"; diff --git a/src/common/options.cc b/src/common/options.cc index aced1b52d8fe4..dcf4d57d06e51 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -7047,6 +7047,10 @@ std::vector