diff options
-rw-r--r-- | src/osdc/Objecter.cc | 156 | ||||
-rw-r--r-- | src/osdc/Objecter.h | 72 |
2 files changed, 0 insertions, 228 deletions
diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 66419451026..cb0d74fdc30 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -3510,162 +3510,6 @@ void Objecter::put_nlist_context_budget(NListContext *list_context) } } -uint32_t Objecter::list_objects_seek(ListContext *list_context, - uint32_t pos) -{ - shared_lock rl(rwlock); - pg_t actual = osdmap->raw_pg_to_pg(pg_t(pos, list_context->pool_id)); - ldout(cct, 10) << "list_objects_seek " << list_context - << " pos " << pos << " -> " << actual << dendl; - list_context->current_pg = actual.ps(); - list_context->cookie = collection_list_handle_t(); - list_context->at_end_of_pg = false; - list_context->at_end_of_pool = false; - list_context->current_pg_epoch = 0; - return list_context->current_pg; -} - -void Objecter::list_objects(ListContext *list_context, Context *onfinish) -{ - ldout(cct, 10) << "list_objects" << dendl; - ldout(cct, 20) << " pool_id " << list_context->pool_id - << " pool_snap_seq " << list_context->pool_snap_seq - << " max_entries " << list_context->max_entries - << " list_context " << list_context - << " onfinish " << onfinish - << " list_context->current_pg " << list_context->current_pg - << " list_context->cookie " << list_context->cookie << dendl; - - if (list_context->at_end_of_pg) { - list_context->at_end_of_pg = false; - ++list_context->current_pg; - list_context->current_pg_epoch = 0; - list_context->cookie = collection_list_handle_t(); - if (list_context->current_pg >= list_context->starting_pg_num) { - list_context->at_end_of_pool = true; - ldout(cct, 20) << " no more pgs; reached end of pool" << dendl; - } else { - ldout(cct, 20) << " move to next pg " << list_context->current_pg - << dendl; - } - } - if (list_context->at_end_of_pool) { - // release the listing context's budget once all - // OPs (in the session) are finished - put_list_context_budget(list_context); - onfinish->complete(0); - return; - } - - shared_lock rl(rwlock); - const pg_pool_t *pool = osdmap->get_pg_pool(list_context->pool_id); - if (!pool) { // pool is gone - rl.unlock(); - put_list_context_budget(list_context); - onfinish->complete(-ENOENT); - return; - } - int pg_num = pool->get_pg_num(); - bool sort_bitwise = osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE); - rl.unlock(); - - if (list_context->starting_pg_num == 0) { // there can't be zero pgs! - list_context->starting_pg_num = pg_num; - list_context->sort_bitwise = sort_bitwise; - ldout(cct, 20) << pg_num << " placement groups" << dendl; - } - if (list_context->sort_bitwise != sort_bitwise) { - ldout(cct, 10) << " hobject sort order changed, restarting this pg" - << dendl; - list_context->cookie = collection_list_handle_t(); - list_context->sort_bitwise = sort_bitwise; - } - if (list_context->starting_pg_num != pg_num) { - // start reading from the beginning; the pgs have changed - ldout(cct, 10) << " pg_num changed; restarting with " << pg_num << dendl; - list_context->current_pg = 0; - list_context->cookie = collection_list_handle_t(); - list_context->current_pg_epoch = 0; - list_context->starting_pg_num = pg_num; - } - assert(list_context->current_pg < pg_num); - - ObjectOperation op; - op.pg_ls(list_context->max_entries, list_context->filter, - list_context->cookie, list_context->current_pg_epoch); - list_context->bl.clear(); - C_List *onack = new C_List(list_context, onfinish, this); - object_locator_t oloc(list_context->pool_id, list_context->nspace); - - pg_read(list_context->current_pg, oloc, op, &list_context->bl, 0, onack, - &onack->epoch, &list_context->ctx_budget); -} - -void Objecter::_list_reply(ListContext *list_context, int r, - Context *final_finish, epoch_t reply_epoch) -{ - ldout(cct, 10) << "_list_reply" << dendl; - - bufferlist::iterator iter = list_context->bl.begin(); - pg_ls_response_t response; - bufferlist extra_info; - ::decode(response, iter); - if (!iter.end()) { - ::decode(extra_info, iter); - } - list_context->cookie = response.handle; - if (!list_context->current_pg_epoch) { - // first pgls result, set epoch marker - ldout(cct, 20) << " first pgls piece, reply_epoch is " - << reply_epoch << dendl; - list_context->current_pg_epoch = reply_epoch; - } - - int response_size = response.entries.size(); - ldout(cct, 20) << " response.entries.size " << response_size - << ", response.entries " << response.entries - << ", handle " << response.handle << dendl; - list_context->extra_info.append(extra_info); - if (response_size) { - list_context->list.merge(response.entries); - } - - // if the osd returns 1 (newer code), or handle == MAX, it means we - // hit the end of the pg. - if (response.handle.is_max() || r == 1) { - ldout(cct, 20) << " at end of pg" << dendl; - list_context->at_end_of_pg = true; - } else { - // there is more for this pg; get it? - if (response_size < list_context->max_entries) { - list_context->max_entries -= response_size; - list_objects(list_context, final_finish); - return; - } - } - if (!list_context->list.empty()) { - ldout(cct, 20) << " returning results so far" << dendl; - // release the listing context's budget once all - // OPs (in the session) are finished - put_list_context_budget(list_context); - final_finish->complete(0); - return; - } - - // continue! - list_objects(list_context, final_finish); -} - -void Objecter::put_list_context_budget(ListContext *list_context) { - if (list_context->ctx_budget >= 0) { - ldout(cct, 10) << " release listing context's budget " - << list_context->ctx_budget << dendl; - put_op_budget_bytes(list_context->ctx_budget); - list_context->ctx_budget = -1; - } - } - - // snapshots int Objecter::create_pool_snap(int64_t pool, string& snap_name, diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 53f87e482bd..38ee33b24b7 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1438,73 +1438,6 @@ public: } }; - // Old pgls context we still use for talking to older OSDs - struct ListContext { - int current_pg; - collection_list_handle_t cookie; - epoch_t current_pg_epoch; - int starting_pg_num; - bool at_end_of_pool; - bool at_end_of_pg; - bool sort_bitwise; - - int64_t pool_id; - int pool_snap_seq; - int max_entries; - string nspace; - - bufferlist bl; // raw data read to here - std::list<pair<object_t, string> > list; - - bufferlist filter; - - bufferlist extra_info; - - // The budget associated with this context, once it is set (>= 0), - // the budget is not get/released on OP basis, instead the budget - // is acquired before sending the first OP and released upon receiving - // the last op reply. - int ctx_budget; - - ListContext() : current_pg(0), current_pg_epoch(0), starting_pg_num(0), - at_end_of_pool(false), - at_end_of_pg(false), - sort_bitwise(false), - pool_id(0), - pool_snap_seq(0), - max_entries(0), - nspace(), - bl(), - list(), - filter(), - extra_info(), - ctx_budget(-1) {} - - bool at_end() const { - return at_end_of_pool; - } - - uint32_t get_pg_hash_position() const { - return current_pg; - } - }; - - struct C_List : public Context { - ListContext *list_context; - Context *final_finish; - Objecter *objecter; - epoch_t epoch; - C_List(ListContext *lc, Context * finish, Objecter *ob) : - list_context(lc), final_finish(finish), objecter(ob), epoch(0) {} - void finish(int r) { - if (r >= 0) { - objecter->_list_reply(list_context, r, final_finish, epoch); - } else { - final_finish->complete(r); - } - } - }; - struct PoolStatOp { ceph_tid_t tid; list<string> pools; @@ -1908,8 +1841,6 @@ private: void _nlist_reply(NListContext *list_context, int r, Context *final_finish, epoch_t reply_epoch); - void _list_reply(ListContext *list_context, int r, Context *final_finish, - epoch_t reply_epoch); void resend_mon_ops(); @@ -1943,7 +1874,6 @@ private: int op_budget = calc_op_budget(op); put_op_budget_bytes(op_budget); } - void put_list_context_budget(ListContext *list_context); void put_nlist_context_budget(NListContext *list_context); Throttle op_throttle_bytes, op_throttle_ops; @@ -2773,8 +2703,6 @@ public: void list_nobjects(NListContext *p, Context *onfinish); uint32_t list_nobjects_seek(NListContext *p, uint32_t pos); - void list_objects(ListContext *p, Context *onfinish); - uint32_t list_objects_seek(ListContext *p, uint32_t pos); hobject_t enumerate_objects_begin(); hobject_t enumerate_objects_end(); |