| 32 | } |
| 33 | |
| 34 | static int cls_2pc_queue_init(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { |
| 35 | auto in_iter = in->cbegin(); |
| 36 | |
| 37 | cls_queue_init_op op; |
| 38 | try { |
| 39 | decode(op, in_iter); |
| 40 | } catch (ceph::buffer::error& err) { |
| 41 | CLS_LOG(1, "ERROR: cls_2pc_queue_init: failed to decode entry: %s", err.what()); |
| 42 | return -EINVAL; |
| 43 | } |
| 44 | |
| 45 | cls_2pc_urgent_data urgent_data; |
| 46 | |
| 47 | cls_queue_init_op init_op; |
| 48 | |
| 49 | CLS_LOG(20, "INFO: cls_2pc_queue_init: max size is %lu (bytes)", op.queue_size); |
| 50 | |
| 51 | init_op.queue_size = op.queue_size; |
| 52 | init_op.max_urgent_data_size = 23552; // overall head is 24KB ~ pending 1K reservations ops |
| 53 | encode(urgent_data, init_op.bl_urgent_data); |
| 54 | |
| 55 | return queue_init(hctx, init_op); |
| 56 | } |
| 57 | |
| 58 | static int cls_2pc_queue_get_capacity(cls_method_context_t hctx, bufferlist *in, bufferlist *out) |
| 59 | { |