diff options
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/osd_client.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 3c0715977de3..c842e877d504 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -121,6 +121,14 @@ static void ceph_osd_data_bio_init(struct ceph_osd_data *osd_data, | |||
121 | &(oreq)->r_ops[whch].typ.fld; \ | 121 | &(oreq)->r_ops[whch].typ.fld; \ |
122 | }) | 122 | }) |
123 | 123 | ||
124 | static struct ceph_osd_data * | ||
125 | osd_req_op_raw_data_in(struct ceph_osd_request *osd_req, unsigned int which) | ||
126 | { | ||
127 | BUG_ON(which >= osd_req->r_num_ops); | ||
128 | |||
129 | return &osd_req->r_ops[which].raw_data_in; | ||
130 | } | ||
131 | |||
124 | struct ceph_osd_data * | 132 | struct ceph_osd_data * |
125 | osd_req_op_extent_osd_data(struct ceph_osd_request *osd_req, | 133 | osd_req_op_extent_osd_data(struct ceph_osd_request *osd_req, |
126 | unsigned int which) | 134 | unsigned int which) |
@@ -137,6 +145,19 @@ osd_req_op_cls_response_data(struct ceph_osd_request *osd_req, | |||
137 | } | 145 | } |
138 | EXPORT_SYMBOL(osd_req_op_cls_response_data); /* ??? */ | 146 | EXPORT_SYMBOL(osd_req_op_cls_response_data); /* ??? */ |
139 | 147 | ||
148 | void osd_req_op_raw_data_in_pages(struct ceph_osd_request *osd_req, | ||
149 | unsigned int which, struct page **pages, | ||
150 | u64 length, u32 alignment, | ||
151 | bool pages_from_pool, bool own_pages) | ||
152 | { | ||
153 | struct ceph_osd_data *osd_data; | ||
154 | |||
155 | osd_data = osd_req_op_raw_data_in(osd_req, which); | ||
156 | ceph_osd_data_pages_init(osd_data, pages, length, alignment, | ||
157 | pages_from_pool, own_pages); | ||
158 | } | ||
159 | EXPORT_SYMBOL(osd_req_op_raw_data_in_pages); | ||
160 | |||
140 | void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *osd_req, | 161 | void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *osd_req, |
141 | unsigned int which, struct page **pages, | 162 | unsigned int which, struct page **pages, |
142 | u64 length, u32 alignment, | 163 | u64 length, u32 alignment, |
@@ -437,7 +458,7 @@ static bool osd_req_opcode_valid(u16 opcode) | |||
437 | * common init routine for all the other init functions, below. | 458 | * common init routine for all the other init functions, below. |
438 | */ | 459 | */ |
439 | static struct ceph_osd_req_op * | 460 | static struct ceph_osd_req_op * |
440 | osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which, | 461 | _osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which, |
441 | u16 opcode) | 462 | u16 opcode) |
442 | { | 463 | { |
443 | struct ceph_osd_req_op *op; | 464 | struct ceph_osd_req_op *op; |
@@ -452,12 +473,19 @@ osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which, | |||
452 | return op; | 473 | return op; |
453 | } | 474 | } |
454 | 475 | ||
476 | void osd_req_op_init(struct ceph_osd_request *osd_req, | ||
477 | unsigned int which, u16 opcode) | ||
478 | { | ||
479 | (void)_osd_req_op_init(osd_req, which, opcode); | ||
480 | } | ||
481 | EXPORT_SYMBOL(osd_req_op_init); | ||
482 | |||
455 | void osd_req_op_extent_init(struct ceph_osd_request *osd_req, | 483 | void osd_req_op_extent_init(struct ceph_osd_request *osd_req, |
456 | unsigned int which, u16 opcode, | 484 | unsigned int which, u16 opcode, |
457 | u64 offset, u64 length, | 485 | u64 offset, u64 length, |
458 | u64 truncate_size, u32 truncate_seq) | 486 | u64 truncate_size, u32 truncate_seq) |
459 | { | 487 | { |
460 | struct ceph_osd_req_op *op = osd_req_op_init(osd_req, which, opcode); | 488 | struct ceph_osd_req_op *op = _osd_req_op_init(osd_req, which, opcode); |
461 | size_t payload_len = 0; | 489 | size_t payload_len = 0; |
462 | 490 | ||
463 | BUG_ON(opcode != CEPH_OSD_OP_READ && opcode != CEPH_OSD_OP_WRITE); | 491 | BUG_ON(opcode != CEPH_OSD_OP_READ && opcode != CEPH_OSD_OP_WRITE); |
@@ -495,7 +523,7 @@ EXPORT_SYMBOL(osd_req_op_extent_update); | |||
495 | void osd_req_op_cls_init(struct ceph_osd_request *osd_req, unsigned int which, | 523 | void osd_req_op_cls_init(struct ceph_osd_request *osd_req, unsigned int which, |
496 | u16 opcode, const char *class, const char *method) | 524 | u16 opcode, const char *class, const char *method) |
497 | { | 525 | { |
498 | struct ceph_osd_req_op *op = osd_req_op_init(osd_req, which, opcode); | 526 | struct ceph_osd_req_op *op = _osd_req_op_init(osd_req, which, opcode); |
499 | struct ceph_pagelist *pagelist; | 527 | struct ceph_pagelist *pagelist; |
500 | size_t payload_len = 0; | 528 | size_t payload_len = 0; |
501 | size_t size; | 529 | size_t size; |
@@ -532,7 +560,7 @@ void osd_req_op_watch_init(struct ceph_osd_request *osd_req, | |||
532 | unsigned int which, u16 opcode, | 560 | unsigned int which, u16 opcode, |
533 | u64 cookie, u64 version, int flag) | 561 | u64 cookie, u64 version, int flag) |
534 | { | 562 | { |
535 | struct ceph_osd_req_op *op = osd_req_op_init(osd_req, which, opcode); | 563 | struct ceph_osd_req_op *op = _osd_req_op_init(osd_req, which, opcode); |
536 | 564 | ||
537 | BUG_ON(opcode != CEPH_OSD_OP_NOTIFY_ACK && opcode != CEPH_OSD_OP_WATCH); | 565 | BUG_ON(opcode != CEPH_OSD_OP_NOTIFY_ACK && opcode != CEPH_OSD_OP_WATCH); |
538 | 566 | ||
@@ -584,6 +612,8 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req, | |||
584 | 612 | ||
585 | switch (src->op) { | 613 | switch (src->op) { |
586 | case CEPH_OSD_OP_STAT: | 614 | case CEPH_OSD_OP_STAT: |
615 | osd_data = &src->raw_data_in; | ||
616 | ceph_osdc_msg_data_add(req->r_reply, osd_data); | ||
587 | break; | 617 | break; |
588 | case CEPH_OSD_OP_READ: | 618 | case CEPH_OSD_OP_READ: |
589 | case CEPH_OSD_OP_WRITE: | 619 | case CEPH_OSD_OP_WRITE: |