]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/ObjectCacher: limit writeback IOs generated while holding lock
authorSage Weil <sage@inktank.com>
Tue, 1 Oct 2013 16:28:29 +0000 (09:28 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Wed, 9 Apr 2014 23:21:48 +0000 (16:21 -0700)
While analyzing a log from Mike Dawson I saw a long stall while librbd's
objectcacher was starting lots (many hundreds) of IOs.  Limit the amount of
time we spend doing this at a time to allow IO replies to be processed so
that the cache remains responsive.

I'm not sure this warrants a tunable (which we would need to add for both
libcephfs and librbd).

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit cce990efc8f2a58c8d0fa11c234ddf2242b1b856)

src/osdc/ObjectCacher.cc

index 09f5bdb18a48b2707744ce69cb5ee0a0294cb698..9450a27de36206790c3a9391cea783d057f3d761 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "include/assert.h"
 
+#define MAX_FLUSH_UNDER_LOCK 20  ///< max bh's we start writeback on while holding the lock
+
 /*** ObjectCacher::BufferHead ***/
 
 
@@ -1447,8 +1449,10 @@ void ObjectCacher::flusher_entry()
       utime_t cutoff = ceph_clock_now(cct);
       cutoff -= max_dirty_age;
       BufferHead *bh = 0;
+      int max = MAX_FLUSH_UNDER_LOCK;
       while ((bh = static_cast<BufferHead*>(bh_lru_dirty.lru_get_next_expire())) != 0 &&
-            bh->last_write < cutoff) {
+            bh->last_write < cutoff &&
+            --max > 0) {
        ldout(cct, 10) << "flusher flushing aged dirty bh " << *bh << dendl;
        bh_write(bh);
       }