From ca33241286f52d849dbde8092507131b8b1108cc Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Tue, 9 Aug 2016 16:49:41 -0400 Subject: [PATCH] rgw file: remove busy-wait in RGWLibFS::gc() This is a background thread. However, CPU is wasted. Signed-off-by: Matt Benjamin --- src/rgw/rgw_file.cc | 1 + src/rgw/rgw_file.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index e4540997d1677..3ecd565145f2c 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -679,6 +679,7 @@ namespace rgw { } /* rgw_fh */ } /* event::type::READDIR */ } /* ev */ + std::this_thread::sleep_for(gc_interval); } while (! stop); } /* RGWLibFS::gc */ diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 03bc95775cd26..5f871eee433ea 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -687,6 +687,9 @@ namespace rgw { struct rgw_fs fs; RGWFileHandle root_fh; + static constexpr std::chrono::seconds gc_interval = + std::chrono::seconds(120); + mutable std::atomic refcnt; RGWFileHandle::FHCache fh_cache; -- 2.39.5