aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-08 14:35:36 -0500
committerSage Weil <sage@inktank.com>2013-05-02 00:17:04 -0400
commit95e072eb38f99c724739d91a1f12bb8bfe1619b5 (patch)
tree8408a57ce11d519590850ddeb3479a0d15d4371a /net/ceph
parent9a5e6d09ddd0cd68ce64c3aa54095e4a0e85b089 (diff)
libceph: kill osd request r_trail
The osd trail is a pagelist, used only for a CALL osd operation to hold the class and method names, along with any input data for the call. It is only currently used by the rbd client, and when it's used it is the only bit of outbound data in the osd request. Since we already support (non-trail) pagelist data in a message, we can just save this outbound CALL data in the "normal" pagelist rather than the trail, and get rid of the trail entirely. The existing pagelist support depends on the pagelist being dynamically allocated, and ownership of it is passed to the messenger once it's been attached to a message. (That is to say, the messenger releases and frees the pagelist when it's done with it). That means we need to dynamically allocate the pagelist also. Note that we simply assert that the allocation of a pagelist structure succeeds. Appending to a pagelist might require a dynamic allocation, so we're already assuming we won't run into trouble doing so (we're just ignore any failures--and that should be fixed at some point). This resolves: http://tracker.ceph.com/issues/4407 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.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 4159df2d67af..cb14db8496bd 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -138,7 +138,6 @@ void ceph_osdc_release_request(struct kref *kref)
138 } 138 }
139 139
140 ceph_put_snap_context(req->r_snapc); 140 ceph_put_snap_context(req->r_snapc);
141 ceph_pagelist_release(&req->r_trail);
142 if (req->r_mempool) 141 if (req->r_mempool)
143 mempool_free(req, req->r_osdc->req_mempool); 142 mempool_free(req, req->r_osdc->req_mempool);
144 else 143 else
@@ -202,7 +201,6 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
202 201
203 req->r_data_in.type = CEPH_OSD_DATA_TYPE_NONE; 202 req->r_data_in.type = CEPH_OSD_DATA_TYPE_NONE;
204 req->r_data_out.type = CEPH_OSD_DATA_TYPE_NONE; 203 req->r_data_out.type = CEPH_OSD_DATA_TYPE_NONE;
205 ceph_pagelist_init(&req->r_trail);
206 204
207 /* create request message; allow space for oid */ 205 /* create request message; allow space for oid */
208 if (use_mempool) 206 if (use_mempool)
@@ -227,7 +225,7 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
227 struct ceph_osd_req_op *src) 225 struct ceph_osd_req_op *src)
228{ 226{
229 u64 out_data_len = 0; 227 u64 out_data_len = 0;
230 u64 tmp; 228 struct ceph_pagelist *pagelist;
231 229
232 dst->op = cpu_to_le16(src->op); 230 dst->op = cpu_to_le16(src->op);
233 231
@@ -246,18 +244,23 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
246 cpu_to_le32(src->extent.truncate_seq); 244 cpu_to_le32(src->extent.truncate_seq);
247 break; 245 break;
248 case CEPH_OSD_OP_CALL: 246 case CEPH_OSD_OP_CALL:
247 pagelist = kmalloc(sizeof (*pagelist), GFP_NOFS);
248 BUG_ON(!pagelist);
249 ceph_pagelist_init(pagelist);
250
249 dst->cls.class_len = src->cls.class_len; 251 dst->cls.class_len = src->cls.class_len;
250 dst->cls.method_len = src->cls.method_len; 252 dst->cls.method_len = src->cls.method_len;
251 dst->cls.indata_len = cpu_to_le32(src->cls.indata_len); 253 dst->cls.indata_len = cpu_to_le32(src->cls.indata_len);
252 254 ceph_pagelist_append(pagelist, src->cls.class_name,
253 tmp = req->r_trail.length;
254 ceph_pagelist_append(&req->r_trail, src->cls.class_name,
255 src->cls.class_len); 255 src->cls.class_len);
256 ceph_pagelist_append(&req->r_trail, src->cls.method_name, 256 ceph_pagelist_append(pagelist, src->cls.method_name,
257 src->cls.method_len); 257 src->cls.method_len);
258 ceph_pagelist_append(&req->r_trail, src->cls.indata, 258 ceph_pagelist_append(pagelist, src->cls.indata,
259 src->cls.indata_len); 259 src->cls.indata_len);
260 out_data_len = req->r_trail.length - tmp; 260
261 req->r_data_out.type = CEPH_OSD_DATA_TYPE_PAGELIST;
262 req->r_data_out.pagelist = pagelist;
263 out_data_len = pagelist->length;
261 break; 264 break;
262 case CEPH_OSD_OP_STARTSYNC: 265 case CEPH_OSD_OP_STARTSYNC:
263 break; 266 break;
@@ -1782,8 +1785,6 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1782 1785
1783 ceph_osdc_msg_data_set(req->r_reply, &req->r_data_in); 1786 ceph_osdc_msg_data_set(req->r_reply, &req->r_data_in);
1784 ceph_osdc_msg_data_set(req->r_request, &req->r_data_out); 1787 ceph_osdc_msg_data_set(req->r_request, &req->r_data_out);
1785 if (req->r_trail.length)
1786 ceph_msg_data_set_trail(req->r_request, &req->r_trail);
1787 1788
1788 register_request(osdc, req); 1789 register_request(osdc, req);
1789 1790