From: Sage Weil Date: Mon, 13 Jan 2014 23:09:27 +0000 (-0800) Subject: osd/ReplicatedPG: use get_object_context in trim_object X-Git-Tag: v0.77~22^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1058%2Fhead;p=ceph.git osd/ReplicatedPG: use get_object_context in trim_object find_object_context() has all the logic to choose a particular clone given a logical snap. In the trim case, we want none of that: we just need to pull the obc for a specific clone instance. Note that this changes none of the failure cases (previous we asserted r == 0). Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 214f48c905e6..8ec8509217a9 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2093,13 +2093,12 @@ ReplicatedPG::RepGather *ReplicatedPG::trim_object(const hobject_t &coid) { // load clone info bufferlist bl; - ObjectContextRef obc; - int r = find_object_context(coid, &obc, false, NULL); - if (r == -ENOENT || coid.snap != obc->obs.oi.soid.snap) { + int r; + ObjectContextRef obc = get_object_context(coid, false, NULL); + if (!obc) { derr << __func__ << "could not find coid " << coid << dendl; assert(0); } - assert(r == 0); object_info_t &coi = obc->obs.oi; set old_snaps(coi.snaps.begin(), coi.snaps.end());