summaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-03 08:28:58 +0200
committerSage Weil <sage@inktank.com>2013-05-02 06:18:14 +0200
commit8c042b0df99cd06ef8473ef6e204b87b3dc80158 (patch)
tree234f410f3253401efa7266cdd67a6e87b22e8bac /net/ceph
parentlibceph: rename data out field in osd request op (diff)
downloadlinux-8c042b0df99cd06ef8473ef6e204b87b3dc80158.tar.xz
linux-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 'net/ceph')
-rw-r--r--net/ceph/osd_client.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 87fcf0b795c0..23491e92b229 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -372,6 +372,13 @@ void osd_req_op_extent_update(struct ceph_osd_req_op *op, u64 length)
}
EXPORT_SYMBOL(osd_req_op_extent_update);
+void osd_req_op_extent_osd_data(struct ceph_osd_req_op *op,
+ struct ceph_osd_data *osd_data)
+{
+ op->extent.osd_data = osd_data;
+}
+EXPORT_SYMBOL(osd_req_op_extent_osd_data);
+
void osd_req_op_cls_init(struct ceph_osd_req_op *op, u16 opcode,
const char *class, const char *method,
const void *request_data, size_t request_data_size)
@@ -406,6 +413,13 @@ void osd_req_op_cls_init(struct ceph_osd_req_op *op, u16 opcode,
}
EXPORT_SYMBOL(osd_req_op_cls_init);
+void osd_req_op_cls_response_data(struct ceph_osd_req_op *op,
+ struct ceph_osd_data *response_data)
+{
+ op->cls.response_data = response_data;
+}
+EXPORT_SYMBOL(osd_req_op_cls_response_data);
+
void osd_req_op_watch_init(struct ceph_osd_req_op *op, u16 opcode,
u64 cookie, u64 version, int flag)
{
@@ -449,6 +463,10 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
cpu_to_le64(src->extent.truncate_size);
dst->extent.truncate_seq =
cpu_to_le32(src->extent.truncate_seq);
+ if (src->op == CEPH_OSD_OP_WRITE)
+ WARN_ON(src->extent.osd_data != &req->r_data_out);
+ else
+ WARN_ON(src->extent.osd_data != &req->r_data_in);
break;
case CEPH_OSD_OP_CALL:
pagelist = kmalloc(sizeof (*pagelist), GFP_NOFS);
@@ -464,8 +482,9 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
src->cls.method_len);
ceph_pagelist_append(pagelist, src->cls.request_data,
src->cls.request_data_len);
-
ceph_osd_data_pagelist_init(&req->r_data_out, pagelist);
+
+ WARN_ON(src->cls.response_data != &req->r_data_in);
request_data_len = pagelist->length;
break;
case CEPH_OSD_OP_STARTSYNC:
@@ -609,6 +628,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
bool use_mempool)
{
struct ceph_osd_request *req;
+ struct ceph_osd_data *osd_data;
struct ceph_osd_req_op *op;
u64 objnum = 0;
u64 objoff = 0;
@@ -623,6 +643,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
GFP_NOFS);
if (!req)
return ERR_PTR(-ENOMEM);
+ osd_data = opcode == CEPH_OSD_OP_WRITE ? &req->r_data_out
+ : &req->r_data_in;
req->r_flags = flags;
@@ -646,6 +668,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
op = &req->r_ops[0];
osd_req_op_extent_init(op, opcode, objoff, objlen,
truncate_size, truncate_seq);
+ osd_req_op_extent_osd_data(op, osd_data);
+
/*
* A second op in the ops array means the caller wants to
* also issue a include a 'startsync' command so that the