]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw file: remove busy-wait in RGWLibFS::gc()
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 9 Aug 2016 20:49:41 +0000 (16:49 -0400)
committerLoic Dachary <ldachary@redhat.com>
Fri, 26 Aug 2016 07:03:46 +0000 (09:03 +0200)
This is a background thread.  However, CPU is wasted.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit ca33241286f52d849dbde8092507131b8b1108cc)

src/rgw/rgw_file.cc
src/rgw/rgw_file.h

index 1bc6b1f4a480ddd5e06adad59acfc00ee3a7a8e6..7332feff034e931e847df214871c752f799a86ee 100644 (file)
@@ -558,6 +558,7 @@ namespace rgw {
          } /* rgw_fh */
        } /* event::type::READDIR */
       } /* ev */
+      std::this_thread::sleep_for(gc_interval);
     } while (! stop);
   } /* RGWLibFS::gc */
 
index 42b6649105187a18b75f84be369c93ce91eebc98..36ba1ee0d924f0f1ff100a5fb8b3c0d383839a2f 100644 (file)
@@ -679,6 +679,9 @@ namespace rgw {
     struct rgw_fs fs;
     RGWFileHandle root_fh;
 
+    static constexpr std::chrono::seconds gc_interval =
+      std::chrono::seconds(120);
+
     mutable std::atomic<uint64_t> refcnt;
 
     RGWFileHandle::FHCache fh_cache;