From 9dff0bae5a266b6c41318e311c6459c9b45bf70d Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 25 Nov 2021 08:52:37 +0800 Subject: [PATCH] mds: add mds_fscrypt_last_block_max_size option support The maximum size of the last block without the header along with a truncate request when the fscrypt is enabled. Default value is 4KB. Signed-off-by: Xiubo Li --- src/common/options/mds.yaml.in | 10 ++++++++++ src/mds/Server.cc | 3 +++ src/mds/Server.h | 1 + 3 files changed, 14 insertions(+) diff --git a/src/common/options/mds.yaml.in b/src/common/options/mds.yaml.in index cfe678ed464..4d12d5aad8a 100644 --- a/src/common/options/mds.yaml.in +++ b/src/common/options/mds.yaml.in @@ -11,6 +11,16 @@ options: - mds flags: - runtime +- name: mds_fscrypt_last_block_max_size + type: size + level: advanced + desc: maximum size of the last block without the header along with a truncate + request when the fscrypt is enabled. + default: 4_K + services: + - mds + flags: + - runtime - name: mds_valgrind_exit type: bool level: dev diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 31d8f216b7f..628241d754d 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1259,6 +1259,9 @@ void Server::handle_conf_change(const std::set& changed) { if (changed.count("mds_alternate_name_max")) { alternate_name_max = g_conf().get_val("mds_alternate_name_max"); } + if (changed.count("mds_fscrypt_last_block_max_size")) { + fscrypt_last_block_max_size = g_conf().get_val("mds_fscrypt_last_block_max_size"); + } if (changed.count("mds_dir_max_entries")) { dir_max_entries = g_conf().get_val("mds_dir_max_entries"); dout(20) << __func__ << " max entries per directory changed to " diff --git a/src/mds/Server.h b/src/mds/Server.h index 76f38717c72..13e3d66d14c 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -475,6 +475,7 @@ private: double caps_throttle_retry_request_timeout; size_t alternate_name_max = g_conf().get_val("mds_alternate_name_max"); + size_t fscrypt_last_block_max_size = g_conf().get_val("mds_fscrypt_last_block_max_size"); }; static inline constexpr auto operator|(Server::RecallFlags a, Server::RecallFlags b) { -- 2.47.3