]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/OpenFileTable: add option that disables dirfrags prefetch 37383/head
authorYan, Zheng <zyan@redhat.com>
Mon, 13 Jul 2020 02:50:27 +0000 (10:50 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 9 Oct 2020 16:02:44 +0000 (00:02 +0800)
Dirfrags prefetch may speedup rejoin stage of mds recovery. But it may
use lots of memory and cause mds out of memory.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit cc19fc624b1ee4d7e3248d1dfc8f89f8879a46bf)

src/common/options.cc
src/mds/OpenFileTable.cc

index f76a623149472867515b343e10ce1c47aec74d50..6ae016f05c578cb7ab986da8f540652f0073dfdf 100644 (file)
@@ -7983,6 +7983,11 @@ std::vector<Option> get_mds_options() {
     .set_default(10.0)
     .set_description("rate of decay for export targets communicated to clients"),
 
+    Option("mds_oft_prefetch_dirfrags", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(true)
+    .set_description("prefetch dirfrags recorded in open file table on startup")
+    .set_flag(Option::FLAG_STARTUP),
+
     Option("mds_replay_interval", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
     .set_default(1.0)
     .set_description("time in seconds between replay of updates to journal by standby replay MDS"),
index fba4afd9381a3dc716a44b9a00448a005e141717..cbf83f178c269387805e01f6109bdd90df3d8ae5 100644 (file)
@@ -1028,8 +1028,13 @@ void OpenFileTable::_open_ino_finish(inodeno_t ino, int r)
   num_opening_inodes--;
   if (num_opening_inodes == 0) {
     if (prefetch_state == DIR_INODES)  {
-      prefetch_state = DIRFRAGS;
-      _prefetch_dirfrags();
+      if (g_conf().get_val<bool>("mds_oft_prefetch_dirfrags")) {
+       prefetch_state = DIRFRAGS;
+       _prefetch_dirfrags();
+      } else {
+       prefetch_state = FILE_INODES;
+       _prefetch_inodes();
+      }
     } else if (prefetch_state == FILE_INODES) {
       prefetch_state = DONE;
       logseg_destroyed_inos.clear();