All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 15/20] libceph: format class info at init time
Date: Mon, 08 Apr 2013 11:16:59 -0700	[thread overview]
Message-ID: <5163099B.4040607@inktank.com> (raw)
In-Reply-To: <515EDA11.5080106@inktank.com>

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 04/05/2013 07:05 AM, Alex Elder wrote:
> An object class method is formatted using a pagelist which contains
> the class name, the method name, and the data concatenated into an
> osd request's outbound data.
>
> Currently when a class op is initialized in osd_req_op_cls_init(),
> the lengths of and pointers to these three items are recorded.
> Later, when the op is getting formatted into the request message, a
> new pagelist is created and that is when these items get copied into
> the pagelist.
>
> This patch makes it so the pagelist to hold these items is created
> when the op is initialized instead.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   include/linux/ceph/osd_client.h |    3 ++-
>   net/ceph/osd_client.c           |   29 +++++++++++++++--------------
>   2 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/ceph/osd_client.h
> b/include/linux/ceph/osd_client.h
> index 144d57c..71c4157 100644
> --- a/include/linux/ceph/osd_client.h
> +++ b/include/linux/ceph/osd_client.h
> @@ -93,8 +93,9 @@ struct ceph_osd_req_op {
>   			const char *class_name;
>   			const char *method_name;
>   			const void *request_data;
> -			u32 request_data_len;
> +			struct ceph_osd_data *request_info;
>   			struct ceph_osd_data *response_data;
> +			u32 request_data_len;
>   			__u8 class_len;
>   			__u8 method_len;
>   			__u8 argc;
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index e698ccf..6c6d7b8 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -399,28 +399,39 @@ void osd_req_op_cls_init(struct ceph_osd_request
> *osd_req, unsigned int which,
>   			const void *request_data, size_t request_data_size)
>   {
>   	struct ceph_osd_req_op *op = osd_req_op_init(osd_req, which, opcode);
> +	struct ceph_pagelist *pagelist;
>   	size_t payload_len = 0;
>   	size_t size;
>
>   	BUG_ON(opcode != CEPH_OSD_OP_CALL);
>
> +	pagelist = kmalloc(sizeof (*pagelist), GFP_NOFS);
> +	BUG_ON(!pagelist);
> +	ceph_pagelist_init(pagelist);
> +
>   	op->cls.class_name = class;
>   	size = strlen(class);
>   	BUG_ON(size > (size_t) U8_MAX);
>   	op->cls.class_len = size;
> +	ceph_pagelist_append(pagelist, class, size);
>   	payload_len += size;
>
>   	op->cls.method_name = method;
>   	size = strlen(method);
>   	BUG_ON(size > (size_t) U8_MAX);
>   	op->cls.method_len = size;
> +	ceph_pagelist_append(pagelist, method, size);
>   	payload_len += size;
>
>   	op->cls.request_data = request_data;
>   	BUG_ON(request_data_size > (size_t) U32_MAX);
>   	op->cls.request_data_len = (u32) request_data_size;
> +	ceph_pagelist_append(pagelist, request_data, request_data_size);
>   	payload_len += request_data_size;
>
> +	op->cls.request_info = &osd_req->r_data_out;
> +	ceph_osd_data_pagelist_init(op->cls.request_info, pagelist);
> +
>   	op->cls.argc = 0;	/* currently unused */
>
>   	op->payload_len = payload_len;
> @@ -456,7 +467,6 @@ static u64 osd_req_encode_op(struct ceph_osd_request
> *req,
>   {
>   	struct ceph_osd_req_op *src;
>   	u64 request_data_len = 0;
> -	struct ceph_pagelist *pagelist;
>
>   	BUG_ON(which >= req->r_num_ops);
>   	src = &req->r_ops[which];
> @@ -485,23 +495,14 @@ static u64 osd_req_encode_op(struct
> ceph_osd_request *req,
>   			WARN_ON(src->extent.osd_data != &req->r_data_in);
>   		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.request_data_len);
> -		ceph_pagelist_append(pagelist, src->cls.class_name,
> -				     src->cls.class_len);
> -		ceph_pagelist_append(pagelist, src->cls.method_name,
> -				     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;
> +		WARN_ON(src->cls.request_info != &req->r_data_out);
> +		BUG_ON(src->cls.request_info->type !=
> +					CEPH_OSD_DATA_TYPE_PAGELIST);
> +		request_data_len = src->cls.request_info->pagelist->length;
>   		break;
>   	case CEPH_OSD_OP_STARTSYNC:
>   		break;
>


  reply	other threads:[~2013-04-08 18:17 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05 13:57 [PATCH 00/20] libceph: per-op osd request data Alex Elder
2013-04-05 14:01 ` [PATCH 01/20] rbd: define inbound data size for method ops Alex Elder
2013-04-05 18:13   ` Josh Durgin
2013-04-05 14:01 ` [PATCH 02/20] libceph: compute incoming bytes once Alex Elder
2013-04-05 18:14   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 03/20] libceph: define osd data initialization helpers Alex Elder
2013-04-05 18:16   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 04/20] libceph: define a few more helpers Alex Elder
2013-04-05 18:17   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 05/20] libceph: define ceph_osd_data_length() Alex Elder
2013-04-05 18:17   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 06/20] libceph: a few more osd data cleanups Alex Elder
2013-04-05 18:17   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 07/20] rbd: define rbd_osd_req_format_op() Alex Elder
2013-04-05 18:18   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 08/20] libceph: keep source rather than message osd op array Alex Elder
2013-04-08 18:12   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 09/20] libceph: rename data out field in osd request op Alex Elder
2013-04-08 18:12   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 10/20] libceph: add data pointers in osd op structures Alex Elder
2013-04-08 18:13   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 11/20] libceph: specify osd op by index in request Alex Elder
2013-04-08 18:14   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 12/20] rbd: don't set data in rbd_osd_req_format_op() Alex Elder
2013-04-08 18:14   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 13/20] rbd: separate initialization of osd data Alex Elder
2013-04-08 18:14   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 14/20] rbd: rearrange some code for consistency Alex Elder
2013-04-08 18:15   ` Josh Durgin
2013-04-05 14:05 ` [PATCH 15/20] libceph: format class info at init time Alex Elder
2013-04-08 18:16   ` Josh Durgin [this message]
2013-04-05 14:05 ` [PATCH 16/20] libceph: move ceph_osdc_build_request() Alex Elder
2013-04-08 18:17   ` Josh Durgin
2013-04-05 14:05 ` [PATCH 17/20] libceph: set message data when building osd request Alex Elder
2013-04-08 18:17   ` Josh Durgin
2013-04-05 14:05 ` [PATCH 18/20] libceph: combine initializing and setting osd data Alex Elder
2013-04-08 19:59   ` Josh Durgin
2013-04-05 14:06 ` [PATCH 19/20] libceph: set the data pointers when encoding ops Alex Elder
2013-04-08 20:03   ` Josh Durgin
2013-04-05 14:06 ` [PATCH 20/20] libceph: kill off osd request r_data_in and r_data_out Alex Elder
2013-04-08 20:07   ` Josh Durgin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5163099B.4040607@inktank.com \
    --to=josh.durgin@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=elder@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.