Skip to content

Commit

Permalink
osdc: After write try merge bh.
Browse files Browse the repository at this point in the history
Fixes:http://tracker.ceph.com/issues/17270

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
  • Loading branch information
majianpeng committed Oct 19, 2016
1 parent ad2dde1 commit a0970cb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/osdc/ObjectCacher.cc
Expand Up @@ -182,6 +182,7 @@ void ObjectCacher::Object::merge_left(BufferHead *left, BufferHead *right)

// hose right
delete right;
right = nullptr; //see bh_write_commit

ldout(oc->cct, 10) << "merge_left result " << *left << dendl;
}
Expand Down Expand Up @@ -1114,6 +1115,7 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid,
}
}

list <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 +1150,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(bh);
ldout(cct, 10) << "bh_write_commit clean " << *bh << dendl;
} else {
mark_dirty(bh);
Expand All @@ -1156,6 +1159,13 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid,
<< dendl;
}
}

while (!hit.empty()) {
BufferHead *bh = hit.front();
hit.pop_front();
if (bh)
ob->try_merge_bh(bh);
}
}

// update last_commit.
Expand Down

0 comments on commit a0970cb

Please sign in to comment.