Skip to content

Commit

Permalink
Merge pull request ceph#18777 from majianpeng/bluestore-collection-list
Browse files Browse the repository at this point in the history
os/bluestore: optimize _collection_list.

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
tchaikov authored Nov 20, 2017
2 parents 586da3d + ede0d94 commit cb3a5c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7213,8 +7213,7 @@ int BlueStore::_collection_list(
if (!pnext)
pnext = &static_next;

if (start == ghobject_t::get_max() ||
start.hobj.is_max()) {
if (start.is_max() || start.hobj.is_max()) {
goto out;
}
get_coll_key_range(c->cid, c->cnode.bits, &temp_start_key, &temp_end_key,
Expand Down Expand Up @@ -11490,11 +11489,13 @@ int BlueStore::_remove_collection(TransContext *txc, const coll_t &cid,
ghobject_t next;
// Enumerate onodes in db, up to nonexistent_count + 1
// then check if all of them are marked as non-existent.
// Bypass the check if returned number is greater than nonexistent_count
// Bypass the check if (next != ghobject_t::get_max())
r = _collection_list(c->get(), ghobject_t(), ghobject_t::get_max(),
nonexistent_count + 1, &ls, &next);
if (r >= 0) {
bool exists = false; //ls.size() > nonexistent_count;
// If true mean collecton has more objects than nonexistent_count,
// so bypass check.
bool exists = (!next.is_max());
for (auto it = ls.begin(); !exists && it < ls.end(); ++it) {
dout(10) << __func__ << " oid " << *it << dendl;
auto onode = (*c)->onode_map.lookup(*it);
Expand Down
2 changes: 1 addition & 1 deletion src/os/filestore/FileStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5024,7 +5024,7 @@ int FileStore::collection_list(const coll_t& c,
dout(20) << "objects: " << *ls << dendl;

// HashIndex doesn't know the pool when constructing a 'next' value
if (next && !next->is_max()) {
if (!next->is_max()) {
next->hobj.pool = pool;
next->set_shard(shard);
dout(20) << " next " << *next << dendl;
Expand Down

0 comments on commit cb3a5c2

Please sign in to comment.