MCPcopy Create free account
hub / github.com/ceph/ceph / queue_init

Function queue_init

src/cls/queue/cls_queue_src.cc:107–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107int queue_init(cls_method_context_t hctx, const cls_queue_init_op& op)
108{
109 //get head and its size
110 cls_queue_head head;
111 int ret = queue_read_head(hctx, head);
112
113 //head is already initialized
114 if (ret == 0) {
115 return -EEXIST;
116 }
117
118 if (ret < 0 && ret != -EINVAL) {
119 return ret;
120 }
121
122 if (op.bl_urgent_data.length() > 0) {
123 head.bl_urgent_data = op.bl_urgent_data;
124 }
125
126 head.max_head_size = QUEUE_HEAD_SIZE_1K + op.max_urgent_data_size;
127 head.queue_size = op.queue_size + head.max_head_size;
128 head.max_urgent_data_size = op.max_urgent_data_size;
129 head.tail.gen = head.front.gen = 0;
130 head.tail.offset = head.front.offset = head.max_head_size;
131
132 CLS_LOG(20, "INFO: init_queue_op queue actual size %lu", head.queue_size);
133 CLS_LOG(20, "INFO: init_queue_op head size %lu", head.max_head_size);
134 CLS_LOG(20, "INFO: init_queue_op queue front offset %s", head.front.to_str().c_str());
135 CLS_LOG(20, "INFO: init_queue_op queue max urgent data size %lu", head.max_urgent_data_size);
136
137 return queue_write_head(hctx, head);
138}
139
140int queue_get_capacity(cls_method_context_t hctx, cls_queue_get_capacity_ret& op_ret)
141{

Callers 3

cls_2pc_queue_initFunction · 0.85
cls_queue_initFunction · 0.85
cls_rgw_gc_queue_initFunction · 0.85

Calls 5

queue_read_headFunction · 0.85
queue_write_headFunction · 0.85
lengthMethod · 0.45
c_strMethod · 0.45
to_strMethod · 0.45

Tested by

no test coverage detected