Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
  • Loading branch information
xiexingguo committed Jan 12, 2017
1 parent 689791c commit 3d73cb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/config_opts.h
Expand Up @@ -1045,6 +1045,7 @@ OPTION(bluestore_extent_map_shard_min_size, OPT_U32, 150)
OPTION(bluestore_extent_map_shard_target_size_slop, OPT_DOUBLE, .2)
OPTION(bluestore_extent_map_inline_shard_prealloc_size, OPT_U32, 256)
OPTION(bluestore_cache_trim_interval, OPT_DOUBLE, .1)
OPTION(bluestore_cache_trim_max_skip_pinned, OPT_U32, 64) // skip this many onodes pinned in cache before we give up
OPTION(bluestore_cache_type, OPT_STR, "2q") // lru, 2q
OPTION(bluestore_2q_cache_kin_ratio, OPT_DOUBLE, .5) // kin page slot size / max page slot size
OPTION(bluestore_2q_cache_kout_ratio, OPT_DOUBLE, .5) // number of kout page slot / total number of page slot
Expand Down
16 changes: 16 additions & 0 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -642,12 +642,20 @@ void BlueStore::LRUCache::_trim(uint64_t onode_max, uint64_t buffer_max)
auto p = onode_lru.end();
assert(p != onode_lru.begin());
--p;
int skipped = 0;
int max_skipped = g_conf->bluestore_cache_trim_max_skip_pinned;
while (num > 0) {
Onode *o = &*p;
int refs = o->nref.load();
if (refs > 1) {
dout(20) << __func__ << " " << o->oid << " has " << refs
<< " refs, skipping" << dendl;
if (++skipped >= max_skipped) {
dout(20) << __func__ << " maximum skip pinned reached; stopping with "
<< num << " left to trim" << dendl;
break;
}

if (p == onode_lru.begin()) {
break;
} else {
Expand Down Expand Up @@ -900,12 +908,20 @@ void BlueStore::TwoQCache::_trim(uint64_t onode_max, uint64_t buffer_max)
auto p = onode_lru.end();
assert(p != onode_lru.begin());
--p;
int skipped = 0;
int max_skipped = g_conf->bluestore_cache_trim_max_skip_pinned;
while (num > 0) {
Onode *o = &*p;
int refs = o->nref.load();
if (refs > 1) {
dout(20) << __func__ << " " << o->oid << " has " << refs
<< " refs; skipping" << dendl;
if (++skipped >= max_skipped) {
dout(20) << __func__ << " maximum skip pinned reached; stopping with "
<< num << " left to trim" << dendl;
break;
}

if (p == onode_lru.begin()) {
break;
} else {
Expand Down

0 comments on commit 3d73cb8

Please sign in to comment.