summaryrefslogtreecommitdiff
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-03 01:28:58 -0500
committerSage Weil <sage@inktank.com>2013-05-01 21:18:14 -0700
commit8c042b0df99cd06ef8473ef6e204b87b3dc80158 (patch)
tree234f410f3253401efa7266cdd67a6e87b22e8bac /drivers/block/rbd.c
parent54d5064912649e296552f298e6472ffd37cd8f90 (diff)
downloadlwn-8c042b0df99cd06ef8473ef6e204b87b3dc80158.tar.gz
lwn-8c042b0df99cd06ef8473ef6e204b87b3dc80158.zip
libceph: add data pointers in osd op structures
An extent type osd operation currently implies that there will be corresponding data supplied in the data portion of the request (for write) or response (for read) message. Similarly, an osd class method operation implies a data item will be supplied to receive the response data from the operation. Add a ceph_osd_data pointer to each of those structures, and assign it to point to eithre the incoming or the outgoing data structure in the osd message. The data is not always available when an op is initially set up, so add two new functions to allow setting them after the op has been initialized. Begin to make use of the data item pointer available in the osd operation rather than the request data in or out structure in places where it's convenient. Add some assertions to verify pointers are always set the way they're expected to be. This is a sort of stepping stone toward really moving the data into the osd request ops, to allow for some validation before making that jump. This is the first in a series of patches that resolve: http://tracker.ceph.com/issues/4657 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index c12b55559f16..eb64ed0f228f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1315,23 +1315,39 @@ static void rbd_osd_req_format_op(struct rbd_obj_request *obj_request,
bool write_request)
{
struct rbd_img_request *img_request = obj_request->img_request;
+ struct ceph_osd_request *osd_req = obj_request->osd_req;
+ struct ceph_osd_data *osd_data = NULL;
struct ceph_snap_context *snapc = NULL;
u64 snap_id = CEPH_NOSNAP;
struct timespec *mtime = NULL;
struct timespec now;
- rbd_assert(obj_request->osd_req != NULL);
+ rbd_assert(osd_req != NULL);
if (write_request) {
+ osd_data = &osd_req->r_data_out;
now = CURRENT_TIME;
mtime = &now;
if (img_request)
snapc = img_request->snapc;
- } else if (img_request) {
- snap_id = img_request->snap_id;
+ } else {
+ osd_data = &osd_req->r_data_in;
+ if (img_request)
+ snap_id = img_request->snap_id;
}
+ if (obj_request->type != OBJ_REQUEST_NODATA) {
+ struct ceph_osd_req_op *op = &obj_request->osd_req->r_ops[0];
- ceph_osdc_build_request(obj_request->osd_req, obj_request->offset,
+ /*
+ * If it has data, it's either a object class method
+ * call (cls) or it's an extent operation.
+ */
+ if (op->op == CEPH_OSD_OP_CALL)
+ osd_req_op_cls_response_data(op, osd_data);
+ else
+ osd_req_op_extent_osd_data(op, osd_data);
+ }
+ ceph_osdc_build_request(osd_req, obj_request->offset,
snapc, snap_id, mtime);
}