From 51679affb2301c5f92bd0c952021c5f2d7befd50 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 13 Feb 2017 11:55:53 -0500 Subject: [PATCH] osd: drop unused+inefficient support for pg[n]ls at a specific snapid This was super slow, and Objecter was incapable of generating the requests to use it. To do this properly we should create a new listing op that returns the set of clones and/or snaps for each object as part of a single listing result. If/when the need arises. Signed-off-by: Sage Weil --- src/osd/PrimaryLogPG.cc | 60 +++++++---------------------------------- 1 file changed, 10 insertions(+), 50 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 006f5d5fd13..f001fc34822 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -1066,6 +1066,10 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) // fall through case CEPH_OSD_OP_PGNLS: + if (snapid != CEPH_NOSNAP) { + result = -EINVAL; + break; + } if (get_osdmap()->raw_pg_to_pg(m->get_pg()) != info.pgid.pgid) { dout(10) << " pgnls pg=" << m->get_pg() << " " << get_osdmap()->raw_pg_to_pg(m->get_pg()) @@ -1115,8 +1119,6 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) break; } - assert(snapid == CEPH_NOSNAP || pg_log.get_missing().get_items().empty()); - map::const_iterator missing_iter = pg_log.get_missing().get_items().lower_bound(current); vector::iterator ls_iter = sentries.begin(); @@ -1164,32 +1166,9 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) if (candidate.snap == CEPH_SNAPDIR) continue; - if (candidate.snap < snapid) + if (candidate.snap != CEPH_NOSNAP) continue; - if (snapid != CEPH_NOSNAP) { - bufferlist bl; - if (candidate.snap == CEPH_NOSNAP) { - pgbackend->objects_get_attr( - candidate, - SS_ATTR, - &bl); - SnapSet snapset(bl); - if (snapid <= snapset.seq) - continue; - } else { - bufferlist attr_bl; - pgbackend->objects_get_attr( - candidate, OI_ATTR, &attr_bl); - object_info_t oi(attr_bl); - vector::iterator i = find(oi.snaps.begin(), - oi.snaps.end(), - snapid); - if (i == oi.snaps.end()) - continue; - } - } - // skip internal namespace if (candidate.get_namespace() == cct->_conf->osd_hit_set_namespace) continue; @@ -1258,6 +1237,10 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) // fall through case CEPH_OSD_OP_PGLS: + if (snapid != CEPH_NOSNAP) { + result = -EINVAL; + break; + } if (get_osdmap()->raw_pg_to_pg(m->get_pg()) != info.pgid.pgid) { dout(10) << " pgls pg=" << m->get_pg() << " " << get_osdmap()->raw_pg_to_pg(m->get_pg()) @@ -1339,32 +1322,9 @@ void PrimaryLogPG::do_pg_op(OpRequestRef op) if (candidate.snap == CEPH_SNAPDIR) continue; - if (candidate.snap < snapid) + if (candidate.snap != CEPH_NOSNAP) continue; - if (snapid != CEPH_NOSNAP) { - bufferlist bl; - if (candidate.snap == CEPH_NOSNAP) { - pgbackend->objects_get_attr( - candidate, - SS_ATTR, - &bl); - SnapSet snapset(bl); - if (snapid <= snapset.seq) - continue; - } else { - bufferlist attr_bl; - pgbackend->objects_get_attr( - candidate, OI_ATTR, &attr_bl); - object_info_t oi(attr_bl); - vector::iterator i = find(oi.snaps.begin(), - oi.snaps.end(), - snapid); - if (i == oi.snaps.end()) - continue; - } - } - // skip wrong namespace if (candidate.get_namespace() != m->get_object_locator().nspace) continue;