| 18 | const uint64_t large_chunk_size = 1ul << 22; |
| 19 | |
| 20 | int queue_write_head(cls_method_context_t hctx, cls_queue_head& head) |
| 21 | { |
| 22 | bufferlist bl; |
| 23 | uint16_t entry_start = QUEUE_HEAD_START; |
| 24 | encode(entry_start, bl); |
| 25 | |
| 26 | bufferlist bl_head; |
| 27 | encode(head, bl_head); |
| 28 | |
| 29 | uint64_t encoded_len = bl_head.length(); |
| 30 | encode(encoded_len, bl); |
| 31 | |
| 32 | bl.claim_append(bl_head); |
| 33 | |
| 34 | if (bl.length() > head.max_head_size) { |
| 35 | CLS_LOG(0, "ERROR: queue_write_head: invalid head size = %u and urgent data size = %u \n", bl.length(), head.bl_urgent_data.length()); |
| 36 | return -EINVAL; |
| 37 | } |
| 38 | |
| 39 | int ret = cls_cxx_write2(hctx, 0, bl.length(), &bl, CEPH_OSD_OP_FLAG_FADVISE_WILLNEED); |
| 40 | if (ret < 0) { |
| 41 | CLS_LOG(5, "ERROR: queue_write_head: failed to write head"); |
| 42 | return ret; |
| 43 | } |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | int queue_read_head(cls_method_context_t hctx, cls_queue_head& head) |
| 48 | { |
no test coverage detected