From be8db8c3380b9d09e7165691f7a56ec67a9bf56c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 13 Jan 2014 15:09:27 -0800 Subject: [PATCH] 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 --- src/osd/ReplicatedPG.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 214f48c905e6f..8ec8509217a94 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()); -- 2.39.5