From: Yehuda Sadeh Date: Tue, 27 Mar 2012 21:12:55 +0000 (-0700) Subject: rgw: remove pool_list(), can't list_objects() on system buckets X-Git-Tag: v0.45~45^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=69844496cac8f19f417adaa0ab80a9a966fa8d23;p=ceph.git rgw: remove pool_list(), can't list_objects() on system buckets pool_list() was broken, replaced now with pool_iterate(). list_objects() shouldn't be used any more with system buckets (raw pools), we can't have it return sorted list of objects without reading the entire list. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index d4cfa493e894..662471656bcf 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -712,19 +712,15 @@ int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string& string cur_marker = marker; bool truncated; + if (bucket_is_system(bucket)) { + return -EINVAL; + } result.clear(); do { std::map ent_map; - int r; - - if (bucket_is_system(bucket)) { - r = pool_list(bucket, cur_marker, max - count, ent_map, - &truncated, &cur_marker); - } else { - r = cls_bucket_list(bucket, cur_marker, prefix, max - count, ent_map, + int r = cls_bucket_list(bucket, cur_marker, prefix, max - count, ent_map, &truncated, &cur_marker); - } if (r < 0) return r; @@ -2653,51 +2649,6 @@ int RGWRados::distribute(bufferlist& bl) return r; } -int RGWRados::pool_list(rgw_bucket& bucket, string start, uint32_t num, map& m, - bool *is_truncated, string *last_entry) -{ - librados::IoCtx io_ctx; - int r = open_bucket_ctx(bucket, io_ctx); - if (r < 0) - return r; - - librados::ObjectIterator iter = io_ctx.objects_begin(); - if (!start.empty()) { - while (iter != io_ctx.objects_end()) { - const std::string& oid = iter->first; - ++iter; - - if (oid.compare(start) == 0) { - break; - } - } - } - if (iter == io_ctx.objects_end()) - return -ENOENT; - - uint32_t i; - - string oid; - - for (i = 0; i < num && iter != io_ctx.objects_end(); ++i, ++iter) { - RGWObjEnt e; - oid = iter->first; - - // fill it in with initial values; we may correct later - e.name = oid; - m[e.name] = e; - ldout(cct, 20) << "RGWRados::pool_list: got " << e.name << dendl; - } - - if (m.size()) { - *last_entry = oid; - } - if (is_truncated) - *is_truncated = (iter != io_ctx.objects_end()); - - return m.size(); -} - int RGWRados::pool_iterate_begin(rgw_bucket& bucket, RGWPoolIterCtx& ctx) { librados::IoCtx& io_ctx = ctx.io_ctx; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index c41461274b76..31604c041160 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -568,9 +568,6 @@ public: return (bucket.name[0] == '.'); } - int pool_list(rgw_bucket& bucket, string start, uint32_t num, map& m, - bool *is_truncated, string *last_entry); - int pool_iterate_begin(rgw_bucket& bucket, RGWPoolIterCtx& ctx); int pool_iterate(RGWPoolIterCtx& ctx, uint32_t num, vector& objs, bool *is_truncated, RGWAccessListFilter *filter);