diff options
author | Sage Weil <sage@inktank.com> | 2014-02-12 18:54:30 +0100 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2014-02-12 18:54:30 +0100 |
commit | f7cf25f293940a063728128a26aa199c7241bec3 (patch) | |
tree | 01a068ed1b328851eeb29b3ba52e32a6d7a9f7dd /src/osdc | |
parent | Merge pull request #1199 from ceph/wip-doc-librados-intro (diff) | |
parent | ObjectCacher: remove unused target/max setters (diff) | |
download | ceph-f7cf25f293940a063728128a26aa199c7241bec3.tar.xz ceph-f7cf25f293940a063728128a26aa199c7241bec3.zip |
Merge pull request #1215 from ceph/wip-7385
Remove the max cached objects restriction for librbd
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/osdc')
-rw-r--r-- | src/osdc/ObjectCacher.cc | 27 | ||||
-rw-r--r-- | src/osdc/ObjectCacher.h | 19 |
2 files changed, 15 insertions, 31 deletions
diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index 6160d7005f1..29dcaaaba5f 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -946,19 +946,14 @@ void ObjectCacher::flush(loff_t amount) } -void ObjectCacher::trim(loff_t max_bytes, loff_t max_ob) +void ObjectCacher::trim() { assert(lock.is_locked()); - if (max_bytes < 0) - max_bytes = max_size; - if (max_ob < 0) - max_ob = max_objects; - - ldout(cct, 10) << "trim start: bytes: max " << max_bytes << " clean " << get_stat_clean() - << ", objects: max " << max_ob << " current " << ob_lru.lru_get_size() + ldout(cct, 10) << "trim start: bytes: max " << max_size << " clean " << get_stat_clean() + << ", objects: max " << max_objects << " current " << ob_lru.lru_get_size() << dendl; - while (get_stat_clean() > max_bytes) { + while (get_stat_clean() > 0 && (uint64_t) get_stat_clean() > max_size) { BufferHead *bh = static_cast<BufferHead*>(bh_lru_rest.lru_expire()); if (!bh) break; @@ -976,7 +971,7 @@ void ObjectCacher::trim(loff_t max_bytes, loff_t max_ob) } } - while (ob_lru.lru_get_size() > max_ob) { + while (ob_lru.lru_get_size() > max_objects) { Object *ob = static_cast<Object*>(ob_lru.lru_expire()); if (!ob) break; @@ -985,8 +980,8 @@ void ObjectCacher::trim(loff_t max_bytes, loff_t max_ob) close_object(ob); } - ldout(cct, 10) << "trim finish: max " << max_bytes << " clean " << get_stat_clean() - << ", objects: max " << max_ob << " current " << ob_lru.lru_get_size() + ldout(cct, 10) << "trim finish: max " << max_size << " clean " << get_stat_clean() + << ", objects: max " << max_objects << " current " << ob_lru.lru_get_size() << dendl; } @@ -1358,7 +1353,9 @@ void ObjectCacher::maybe_wait_for_writeback(uint64_t len) // - do not wait for bytes other waiters are waiting on. this means that // threads do not wait for each other. this effectively allows the cache // size to balloon proportional to the data that is in flight. - while (get_stat_dirty() + get_stat_tx() >= max_dirty + get_stat_dirty_waiting()) { + while (get_stat_dirty() + get_stat_tx() > 0 && + (uint64_t) (get_stat_dirty() + get_stat_tx()) >= + max_dirty + get_stat_dirty_waiting()) { ldout(cct, 10) << __func__ << " waiting for dirty|tx " << (get_stat_dirty() + get_stat_tx()) << " >= max " << max_dirty << " + dirty_waiting " @@ -1413,7 +1410,7 @@ int ObjectCacher::_wait_for_write(OSDWrite *wr, uint64_t len, ObjectSet *oset, M } // start writeback anyway? - if (get_stat_dirty() > target_dirty) { + if (get_stat_dirty() > 0 && (uint64_t) get_stat_dirty() > target_dirty) { ldout(cct, 10) << "wait_for_write " << get_stat_dirty() << " > target " << target_dirty << ", nudging flusher" << dendl; flusher_cond.Signal(); @@ -1437,7 +1434,7 @@ void ObjectCacher::flusher_entry() << max_dirty << " max)" << dendl; loff_t actual = get_stat_dirty() + get_stat_dirty_waiting(); - if (actual > target_dirty) { + if (actual > 0 && (uint64_t) actual > target_dirty) { // flush some dirty pages ldout(cct, 10) << "flusher " << get_stat_dirty() << " dirty + " << get_stat_dirty_waiting() diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index d7ba9d8a50b..f28c24adf99 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -332,7 +332,7 @@ class ObjectCacher { string name; Mutex& lock; - int64_t max_dirty, target_dirty, max_size, max_objects; + uint64_t max_dirty, target_dirty, max_size, max_objects; utime_t max_dirty_age; bool block_writes_upfront; @@ -434,7 +434,7 @@ class ObjectCacher { void bh_read(BufferHead *bh); void bh_write(BufferHead *bh); - void trim(loff_t max_bytes=-1, loff_t max_objects=-1); + void trim(); void flush(loff_t amount=0); /** @@ -615,22 +615,9 @@ public: // cache sizes - void set_max_dirty(int64_t v) { + void set_max_dirty(uint64_t v) { max_dirty = v; } - void set_target_dirty(int64_t v) { - target_dirty = v; - } - void set_max_size(int64_t v) { - max_size = v; - } - void set_max_dirty_age(double a) { - max_dirty_age.set_from_double(a); - } - void set_max_objects(int64_t v) { - max_objects = v; - } - // file functions |