From: Xiaoxi Chen Date: Sat, 25 Apr 2015 01:48:38 +0000 (+0800) Subject: Kill collection_list_partial X-Git-Tag: v9.1.0~421^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d5ed30f023eb60e34120b65b5363d3d02f55b64;p=ceph.git Kill collection_list_partial Use collection_list_impl directly. Signed-off-by: Xiaoxi Chen --- diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 55e11826eb71..1f3ecabfa296 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -4484,7 +4484,7 @@ int FileStore::_collection_remove_recursive(const coll_t &cid, vector objects; ghobject_t max; while (!max.is_max()) { - r = collection_list_partial(cid, max, 200, 300, 0, &objects, &max); + r = collection_list_impl(cid, max, ghobject_t::get_max(), 300, 0, &objects, &max); if (r < 0) return r; for (vector::iterator i = objects.begin(); @@ -4716,19 +4716,6 @@ int FileStore::collection_list_impl(coll_t c, ghobject_t start, ghobject_t end, return 0; } -int FileStore::collection_list_partial(coll_t c, ghobject_t start, - int min, int max, snapid_t seq, - vector *ls, ghobject_t *next) -{ - tracepoint(objectstore, collection_list_partial_enter, c.c_str()); - dout(10) << "collection_list_partial: " << c << " start " << start << dendl; - - assert(next); - int r = collection_list_impl(c, start, ghobject_t::get_max(), max, seq, ls, next); - tracepoint(objectstore, collection_list_partial_exit, 0); - return r; -} - int FileStore::collection_list(coll_t c, vector& ls) { tracepoint(objectstore, collection_list_enter, c.c_str()); @@ -5334,10 +5321,10 @@ int FileStore::_split_collection(coll_t cid, vector objects; ghobject_t next; while (1) { - collection_list_partial( + collection_list_impl( cid, - next, - get_ideal_list_min(), get_ideal_list_max(), 0, + next, ghobject_t::get_max(), + get_ideal_list_max(), 0, &objects, &next); if (objects.empty()) @@ -5353,10 +5340,10 @@ int FileStore::_split_collection(coll_t cid, } next = ghobject_t(); while (1) { - collection_list_partial( + collection_list_impl( dest, - next, - get_ideal_list_min(), get_ideal_list_max(), 0, + next, ghobject_t::get_max(), + get_ideal_list_max(), 0, &objects, &next); if (objects.empty()) diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 7add5741594d..bb08ecaef720 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -626,9 +626,6 @@ public: bool collection_exists(coll_t c); bool collection_empty(coll_t c); int collection_list(coll_t c, vector& oid); - int collection_list_partial(coll_t c, ghobject_t start, - int min, int max, snapid_t snap, - vector *ls, ghobject_t *next); // omap (see ObjectStore.h for documentation) int omap_get(coll_t c, const ghobject_t &oid, bufferlist *header, diff --git a/src/os/KeyValueStore.cc b/src/os/KeyValueStore.cc index 9246b9e3bbc1..8868920f2c42 100644 --- a/src/os/KeyValueStore.cc +++ b/src/os/KeyValueStore.cc @@ -2444,7 +2444,7 @@ int KeyValueStore::_collection_remove_recursive(const coll_t &cid, vector objects; ghobject_t max; while (!max.is_max()) { - r = collection_list_partial(cid, max, 200, 300, 0, &objects, &max); + r = collection_list_impl(cid, max, ghobject_t::get_max(), 300, 0, &objects, &max); if (r < 0) goto out; @@ -2510,21 +2510,9 @@ int KeyValueStore::collection_list_impl(coll_t c, ghobject_t start, return r; } -int KeyValueStore::collection_list_partial(coll_t c, ghobject_t start, - int min, int max, snapid_t seq, - vector *ls, - ghobject_t *next) -{ - dout(10) << __func__ << " " << c << " start:" << start << " is_max:" - << start.is_max() << dendl; - - int r = collection_list_impl(c, start, ghobject_t::get_max(), max, seq, ls, next); - return r; -} - int KeyValueStore::collection_list(coll_t c, vector& ls) { - return collection_list_partial(c, ghobject_t(), 0, 0, 0, &ls, 0); + return collection_list_impl(c, ghobject_t(), ghobject_t::get_max(), 0, 0, &ls, 0); } int KeyValueStore::collection_version_current(coll_t c, uint32_t *version) @@ -2806,7 +2794,7 @@ int KeyValueStore::_split_collection(coll_t cid, uint32_t bits, uint32_t rem, ghobject_t next, current; int move_size = 0; while (1) { - collection_list_partial(cid, current, get_ideal_list_min(), + collection_list_impl(cid, current, ghobject_t::get_max(), get_ideal_list_max(), 0, &objects, &next); dout(20) << __func__ << cid << "objects size: " << objects.size() @@ -2837,7 +2825,7 @@ int KeyValueStore::_split_collection(coll_t cid, uint32_t bits, uint32_t rem, vector objects; ghobject_t next; while (1) { - collection_list_partial(cid, next, get_ideal_list_min(), + collection_list_impl(cid, next, ghobject_t::get_max(), get_ideal_list_max(), 0, &objects, &next); if (objects.empty()) break; @@ -2853,7 +2841,7 @@ int KeyValueStore::_split_collection(coll_t cid, uint32_t bits, uint32_t rem, next = ghobject_t(); while (1) { - collection_list_partial(dest, next, get_ideal_list_min(), + collection_list_impl(dest, next, ghobject_t::get_max(), get_ideal_list_max(), 0, &objects, &next); if (objects.empty()) break; diff --git a/src/os/KeyValueStore.h b/src/os/KeyValueStore.h index 46fba5225ba5..3cb6bc014b87 100644 --- a/src/os/KeyValueStore.h +++ b/src/os/KeyValueStore.h @@ -622,9 +622,6 @@ class KeyValueStore : public ObjectStore, int collection_list_impl(coll_t c, ghobject_t start, ghobject_t end, int max, snapid_t snap, vector *ls, ghobject_t *next); - int collection_list_partial(coll_t c, ghobject_t start, - int min, int max, snapid_t snap, - vector *ls, ghobject_t *next); int collection_version_current(coll_t c, uint32_t *version); // omap (see ObjectStore.h for documentation) diff --git a/src/os/MemStore.cc b/src/os/MemStore.cc index 4394ec1d84eb..bfebdbd0e060 100644 --- a/src/os/MemStore.cc +++ b/src/os/MemStore.cc @@ -461,17 +461,6 @@ int MemStore::collection_list_impl(coll_t cid, ghobject_t start, ghobject_t end, return 0; } -int MemStore::collection_list_partial(coll_t cid, ghobject_t start, - int min, int max, snapid_t snap, - vector *ls, ghobject_t *next) -{ - dout(10) << __func__ << " " << cid << " " << start << " " << min << "-" - << max << " " << snap << dendl; - - collection_list_impl(cid, start, ghobject_t::get_max(), max, snap, ls, next); - return 0; -} - int MemStore::omap_get( coll_t cid, ///< [in] Collection containing oid const ghobject_t &oid, ///< [in] Object containing omap diff --git a/src/os/MemStore.h b/src/os/MemStore.h index 470016cad060..97f41429da2a 100644 --- a/src/os/MemStore.h +++ b/src/os/MemStore.h @@ -310,9 +310,6 @@ public: int collection_list_impl(coll_t cid, ghobject_t start, ghobject_t end, int max, snapid_t snap, vector *ls, ghobject_t *next); - int collection_list_partial(coll_t cid, ghobject_t start, - int min, int max, snapid_t snap, - vector *ls, ghobject_t *next); int omap_get( coll_t cid, ///< [in] Collection containing oid diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index dc83be13ac21..e0a517787f19 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -2037,22 +2037,6 @@ public: */ virtual int collection_list(coll_t c, vector& o) = 0; - /** - * list partial contents of collection relative to a hash offset/position - * - * @param c collection - * @param start list objects that sort >= this value - * @param min return at least this many results, unless we reach the end - * @param max return no more than this many results - * @param snap return no objects with snap < snapid - * @param ls [out] result - * @param next [out] next item sorts >= this value - * @return zero on success, or negative error - */ - virtual int collection_list_partial(coll_t c, ghobject_t start, - int min, int max, snapid_t snap, - vector *ls, ghobject_t *next) = 0; - /** * list contents of a collection that fall in the range [start, end) and no more than a specified many result * diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ebc2d6d8ee25..b5b6d630ed44 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4227,10 +4227,10 @@ bool remove_dir( ObjectStore::Transaction *t = new ObjectStore::Transaction; ghobject_t next; handle.reset_tp_timeout(); - store->collection_list_partial( + store->collection_list_impl( coll, next, - store->get_ideal_list_min(), + ghobject_t::get_max(), store->get_ideal_list_max(), 0, &olist, diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index feab829cbc50..4807a732deba 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -113,10 +113,10 @@ int PGBackend::objects_list_partial( int r = 0; while (!_next.is_max() && ls->size() < (unsigned)min) { vector objects; - int r = store->collection_list_partial( + int r = store->collection_list_impl( coll, _next, - min - ls->size(), + ghobject_t::get_max(), max - ls->size(), seq, &objects, diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 6d1654cd9c91..e13518855075 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -282,7 +282,7 @@ TEST_P(StoreTest, SimpleListTest) { vector objects; ghobject_t next, current; while (!next.is_max()) { - int r = store->collection_list_partial(cid, current, 25, 50, + int r = store->collection_list_impl(cid, current, ghobject_t::get_max(), 50, 0, &objects, &next); ASSERT_EQ(r, 0); cout << " got " << objects.size() << " next " << next << std::endl; @@ -366,7 +366,7 @@ TEST_P(StoreTest, MultipoolListTest) { vector objects; ghobject_t next, current; while (!next.is_max()) { - int r = store->collection_list_partial(cid, current, 25, 50, + int r = store->collection_list_impl(cid, current, ghobject_t::get_max(), 50, 0, &objects, &next); ASSERT_EQ(r, 0); cout << " got " << objects.size() << " next " << next << std::endl; @@ -599,10 +599,10 @@ TEST_P(StoreTest, ManyObjectTest) { ghobject_t start, next; objects.clear(); - r = store->collection_list_partial( + r = store->collection_list_impl( cid, ghobject_t::get_max(), - 50, + ghobject_t::get_max(), 60, 0, &objects, @@ -614,8 +614,8 @@ TEST_P(StoreTest, ManyObjectTest) { objects.clear(); listed.clear(); while (1) { - r = store->collection_list_partial(cid, start, - 50, + r = store->collection_list_impl(cid, start, + ghobject_t::get_max(), 60, 0, &objects, @@ -1101,7 +1101,7 @@ public: ghobject_t next, current; while (1) { cerr << "scanning..." << std::endl; - int r = store->collection_list_partial(cid, current, 50, 100, + int r = store->collection_list_impl(cid, current, ghobject_t::get_max(), 100, 0, &objects, &next); ASSERT_EQ(r, 0); ASSERT_TRUE(sorted(objects)); @@ -1322,7 +1322,7 @@ TEST_P(StoreTest, HashCollisionTest) { listed.clear(); ghobject_t current, next; while (1) { - r = store->collection_list_partial(cid, current, 50, 60, + r = store->collection_list_impl(cid, current, ghobject_t::get_max(), 60, 0, &objects, &next); ASSERT_EQ(r, 0); ASSERT_TRUE(sorted(objects)); @@ -1417,7 +1417,7 @@ TEST_P(StoreTest, ScrubTest) { listed.clear(); ghobject_t current, next; while (1) { - r = store->collection_list_partial(cid, current, 50, 60, + r = store->collection_list_impl(cid, current, ghobject_t::get_max(), 60, 0, &objects, &next); ASSERT_EQ(r, 0); ASSERT_TRUE(sorted(objects)); diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 63ecffee54a9..734c04d86abe 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -79,10 +79,10 @@ int _action_on_all_objects_in_pg(ObjectStore *store, coll_t coll, action_on_obje ghobject_t next; while (!next.is_max()) { vector list; - int r = store->collection_list_partial( + int r = store->collection_list_impl( coll, next, - LIST_AT_A_TIME, + ghobject_t::get_max(), LIST_AT_A_TIME, 0, &list, @@ -412,7 +412,7 @@ void remove_coll(ObjectStore *store, const coll_t &coll) cout << "remove_coll " << coll << std::endl; while (!next.is_max()) { vector objects; - r = store->collection_list_partial(coll, next, 200, 300, 0, + r = store->collection_list_impl(coll, next, ghobject_t::get_max(), 300, 0, &objects, &next); if (r < 0) goto out; @@ -700,7 +700,7 @@ int ObjectStoreTool::export_files(ObjectStore *store, coll_t coll) while (!next.is_max()) { vector objects; - int r = store->collection_list_partial(coll, next, 200, 300, 0, + int r = store->collection_list_impl(coll, next, ghobject_t::get_max(), 300, 0, &objects, &next); if (r < 0) return r;