Skip to content

Commit

Permalink
osdc: After write try merge bh.
Browse files Browse the repository at this point in the history
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
  • Loading branch information
majianpeng committed Oct 21, 2016
1 parent 60c008d commit 8aaa854
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/osdc/ObjectCacher.cc
Expand Up @@ -1114,6 +1114,7 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid,
}
}

vector<pair<loff_t, BufferHead*>> hit;
// apply to bh's!
for (map<loff_t, BufferHead*>::const_iterator p = ob->data_lower_bound(start);
p != ob->data.end();
Expand Down Expand Up @@ -1148,6 +1149,7 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid,
bh->set_journal_tid(0);
if (bh->get_nocache())
bh_lru_rest.lru_bottouch(bh);
hit.push_back(make_pair(bh->start(), bh));
ldout(cct, 10) << "bh_write_commit clean " << *bh << dendl;
} else {
mark_dirty(bh);
Expand All @@ -1156,6 +1158,12 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid,
<< dendl;
}
}

for (auto& p : hit) {
//p.second maybe merged and deleted in merge_left
if (ob->data.count(p.first))
ob->try_merge_bh(p.second);
}
}

// update last_commit.
Expand Down

0 comments on commit 8aaa854

Please sign in to comment.