Skip to content

Commit

Permalink
libceph: kill osd request r_trail
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Elder authored and Sage Weil committed May 2, 2013
1 parent 9a5e6d0 commit 95e072e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion include/linux/ceph/osd_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ struct ceph_osd_request {

struct ceph_osd_data r_data_in;
struct ceph_osd_data r_data_out;
struct ceph_pagelist r_trail; /* trailing part of data out */
};

struct ceph_osd_event {
Expand Down
23 changes: 12 additions & 11 deletions net/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ void ceph_osdc_release_request(struct kref *kref)
}

ceph_put_snap_context(req->r_snapc);
ceph_pagelist_release(&req->r_trail);
if (req->r_mempool)
mempool_free(req, req->r_osdc->req_mempool);
else
Expand Down Expand Up @@ -202,7 +201,6 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,

req->r_data_in.type = CEPH_OSD_DATA_TYPE_NONE;
req->r_data_out.type = CEPH_OSD_DATA_TYPE_NONE;
ceph_pagelist_init(&req->r_trail);

/* create request message; allow space for oid */
if (use_mempool)
Expand All @@ -227,7 +225,7 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
struct ceph_osd_req_op *src)
{
u64 out_data_len = 0;
u64 tmp;
struct ceph_pagelist *pagelist;

dst->op = cpu_to_le16(src->op);

Expand All @@ -246,18 +244,23 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
cpu_to_le32(src->extent.truncate_seq);
break;
case CEPH_OSD_OP_CALL:
pagelist = kmalloc(sizeof (*pagelist), GFP_NOFS);
BUG_ON(!pagelist);
ceph_pagelist_init(pagelist);

dst->cls.class_len = src->cls.class_len;
dst->cls.method_len = src->cls.method_len;
dst->cls.indata_len = cpu_to_le32(src->cls.indata_len);

tmp = req->r_trail.length;
ceph_pagelist_append(&req->r_trail, src->cls.class_name,
ceph_pagelist_append(pagelist, src->cls.class_name,
src->cls.class_len);
ceph_pagelist_append(&req->r_trail, src->cls.method_name,
ceph_pagelist_append(pagelist, src->cls.method_name,
src->cls.method_len);
ceph_pagelist_append(&req->r_trail, src->cls.indata,
ceph_pagelist_append(pagelist, src->cls.indata,
src->cls.indata_len);
out_data_len = req->r_trail.length - tmp;

req->r_data_out.type = CEPH_OSD_DATA_TYPE_PAGELIST;
req->r_data_out.pagelist = pagelist;
out_data_len = pagelist->length;
break;
case CEPH_OSD_OP_STARTSYNC:
break;
Expand Down Expand Up @@ -1782,8 +1785,6 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,

ceph_osdc_msg_data_set(req->r_reply, &req->r_data_in);
ceph_osdc_msg_data_set(req->r_request, &req->r_data_out);
if (req->r_trail.length)
ceph_msg_data_set_trail(req->r_request, &req->r_trail);

register_request(osdc, req);

Expand Down

0 comments on commit 95e072e

Please sign in to comment.