From: Pritha Srivastava Date: Mon, 29 Jul 2019 07:31:25 +0000 (+0530) Subject: Modified code to have the max urgent data size fixed. X-Git-Tag: v15.1.0~1185^2~10 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0581587656b0ec9a66575ca47eccbc3cd01fb0bc;p=ceph-ci.git Modified code to have the max urgent data size fixed. Signed-off-by: Pritha Srivastava --- diff --git a/src/cls/queue/cls_queue.cc b/src/cls/queue/cls_queue.cc index c939b847b7f..7b72c7bdfa0 100644 --- a/src/cls/queue/cls_queue.cc +++ b/src/cls/queue/cls_queue.cc @@ -18,7 +18,6 @@ static int cls_queue_init(cls_method_context_t hctx, bufferlist *in, bufferlist { auto in_iter = in->cbegin(); cls_queue_init_op op; - op.has_urgent_data = false; try { decode(op, in_iter); } catch (buffer::error& err) { diff --git a/src/cls/queue/cls_queue_client.cc b/src/cls/queue/cls_queue_client.cc index bfa6e0a252b..97f67d3d74e 100644 --- a/src/cls/queue/cls_queue_client.cc +++ b/src/cls/queue/cls_queue_client.cc @@ -12,8 +12,8 @@ void cls_queue_init(ObjectWriteOperation& op, const string& queue_name, uint64_t { bufferlist in; cls_queue_init_op call; - call.has_urgent_data = false; - call.head.queue_size = size; + call.max_urgent_data_size = 0; + call.queue_size = size; encode(call, in); op.exec(QUEUE_CLASS, QUEUE_INIT, in); } diff --git a/src/cls/queue/cls_queue_ops.h b/src/cls/queue/cls_queue_ops.h index 9c5a78ea2fb..e48b03dd20f 100644 --- a/src/cls/queue/cls_queue_ops.h +++ b/src/cls/queue/cls_queue_ops.h @@ -4,25 +4,25 @@ #include "cls/queue/cls_queue_types.h" struct cls_queue_init_op { - cls_queue_head head; - uint64_t head_size{0}; - bool has_urgent_data{false}; + uint64_t queue_size{0}; + uint64_t max_urgent_data_size{0}; + bufferlist bl_urgent_data; cls_queue_init_op() {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); - encode(head, bl); - encode(head_size, bl); - encode(has_urgent_data, bl); + encode(queue_size, bl); + encode(max_urgent_data_size, bl); + encode(bl_urgent_data, bl); ENCODE_FINISH(bl); } void decode(bufferlist::const_iterator& bl) { DECODE_START(1, bl); - decode(head, bl); - decode(head_size, bl); - decode(has_urgent_data, bl); + decode(queue_size, bl); + decode(max_urgent_data_size, bl); + decode(bl_urgent_data, bl); DECODE_FINISH(bl); } diff --git a/src/cls/queue/cls_queue_src.cc b/src/cls/queue/cls_queue_src.cc index 22a88a07eb3..77b0a560d76 100644 --- a/src/cls/queue/cls_queue_src.cc +++ b/src/cls/queue/cls_queue_src.cc @@ -105,30 +105,15 @@ int queue_init(cls_method_context_t hctx, const cls_queue_init_op& op) return ret; } - head = std::move(op.head); - - if (op.has_urgent_data) { - if (op.head_size == 0) { - head.max_head_size = QUEUE_HEAD_SIZE_4K; - head.tail.offset = head.front.offset = QUEUE_START_OFFSET_4K; - } else { - head.max_head_size = op.head_size; - head.tail.offset = head.front.offset = head.max_head_size; - } - bufferlist bl_non_urgent; - uint16_t queue_start = QUEUE_HEAD_START; - uint64_t queue_encoded_len = 0;//dummy value for calculating max size of urgent data - encode(queue_start, bl_non_urgent); - encode(queue_encoded_len, bl_non_urgent); - encode(head, bl_non_urgent); - head.max_urgent_data_size = head.max_head_size - (bl_non_urgent.length() - head.bl_urgent_data.length()); - } else { - head.max_head_size = QUEUE_HEAD_SIZE_1K; - head.tail.offset = head.front.offset = QUEUE_START_OFFSET_1K; - head.max_urgent_data_size = 0; + if (op.bl_urgent_data.length() > 0) { + head.bl_urgent_data = op.bl_urgent_data; } + + head.max_head_size = QUEUE_HEAD_SIZE_1K + op.max_urgent_data_size; + head.queue_size = op.queue_size + head.max_head_size; + head.max_urgent_data_size = op.max_urgent_data_size; head.tail.gen = head.front.gen = 0; - head.queue_size += head.max_head_size; + head.tail.offset = head.front.offset = head.max_head_size; CLS_LOG(20, "INFO: init_queue_op queue actual size %lu", head.queue_size); CLS_LOG(20, "INFO: init_queue_op head size %lu", head.max_head_size); diff --git a/src/cls/queue/cls_queue_types.h b/src/cls/queue/cls_queue_types.h index e00b7c2f5f7..cf50cb163f4 100644 --- a/src/cls/queue/cls_queue_types.h +++ b/src/cls/queue/cls_queue_types.h @@ -4,13 +4,10 @@ #include #include "include/types.h" +//Size of head leaving out urgent data #define QUEUE_HEAD_SIZE_1K 1024 -//Actual start offset of queue data -#define QUEUE_START_OFFSET_1K QUEUE_HEAD_SIZE_1K -#define QUEUE_HEAD_SIZE_4K (4 * 1024) -//Actual start offset of queue data -#define QUEUE_START_OFFSET_4K QUEUE_HEAD_SIZE_4K +#define QUEUE_START_OFFSET_1K QUEUE_HEAD_SIZE_1K constexpr unsigned int QUEUE_HEAD_START = 0xDEAD; constexpr unsigned int QUEUE_ENTRY_START = 0xBEEF; diff --git a/src/cls/rgw_gc/cls_rgw_gc.cc b/src/cls/rgw_gc/cls_rgw_gc.cc index e8ddfd12053..1d485753c1f 100644 --- a/src/cls/rgw_gc/cls_rgw_gc.cc +++ b/src/cls/rgw_gc/cls_rgw_gc.cc @@ -43,10 +43,10 @@ static int cls_rgw_gc_queue_init(cls_method_context_t hctx, bufferlist *in, buff cls_queue_init_op init_op; CLS_LOG(10, "INFO: cls_rgw_gc_queue_init: queue size is %lu\n", op.size); - init_op.head.queue_size = op.size; - init_op.head_size = g_ceph_context->_conf->rgw_gc_queue_head_size; - init_op.has_urgent_data = true; - encode(urgent_data, init_op.head.bl_urgent_data); + + init_op.queue_size = op.size; + init_op.max_urgent_data_size = g_ceph_context->_conf->rgw_gc_max_urgent_data_size; + encode(urgent_data, init_op.bl_urgent_data); return queue_init(hctx, init_op); } diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index 6f9414bc1b6..76a4d62fe63 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -1564,4 +1564,4 @@ OPTION(rgw_sts_token_introspection_url, OPT_STR) // url for introspecting web t OPTION(rgw_sts_client_id, OPT_STR) // Client Id OPTION(rgw_sts_client_secret, OPT_STR) // Client Secret OPTION(debug_allow_any_pool_priority, OPT_BOOL) -OPTION(rgw_gc_queue_head_size, OPT_U32) // GC queue head size +OPTION(rgw_gc_max_urgent_data_size, OPT_U64) // GC urgent data size diff --git a/src/common/options.cc b/src/common/options.cc index d2068d5a490..988050e87ba 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -6462,9 +6462,9 @@ std::vector