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 04/20] libceph: define a few more helpers
Date: Fri, 05 Apr 2013 11:17:06 -0700	[thread overview]
Message-ID: <515F1522.5030402@inktank.com> (raw)
In-Reply-To: <515ED966.50704@inktank.com>

There's a sizeof without parentheses, but after fixing that:

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

On 04/05/2013 07:02 AM, Alex Elder wrote:
> Define ceph_osd_data_init() and ceph_osd_data_release() to clean up
> a little code.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   net/ceph/osd_client.c |   44 ++++++++++++++++++++++++++------------------
>   1 file changed, 26 insertions(+), 18 deletions(-)
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index f8f8561..df0f856 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -79,6 +79,12 @@ static int calc_layout(struct ceph_file_layout
> *layout, u64 off, u64 *plen,
>   	return 0;
>   }
>
> +static void ceph_osd_data_init(struct ceph_osd_data *osd_data)
> +{
> +	memset(osd_data, 0, sizeof *osd_data);
> +	osd_data->type = CEPH_OSD_DATA_TYPE_NONE;
> +}
> +
>   void ceph_osd_data_pages_init(struct ceph_osd_data *osd_data,
>   			struct page **pages, u64 length, u32 alignment,
>   			bool pages_from_pool, bool own_pages)
> @@ -111,16 +117,28 @@ void ceph_osd_data_bio_init(struct ceph_osd_data
> *osd_data,
>   EXPORT_SYMBOL(ceph_osd_data_bio_init);
>   #endif /* CONFIG_BLOCK */
>
> +static void ceph_osd_data_release(struct ceph_osd_data *osd_data)
> +{
> +	if (osd_data->type != CEPH_OSD_DATA_TYPE_PAGES)
> +		return;
> +
> +	if (osd_data->own_pages) {
> +		int num_pages;
> +
> +		num_pages = calc_pages_for((u64)osd_data->alignment,
> +						(u64)osd_data->length);
> +		ceph_release_page_vector(osd_data->pages, num_pages);
> +	}
> +}
> +
>   /*
>    * requests
>    */
>   void ceph_osdc_release_request(struct kref *kref)
>   {
> -	int num_pages;
> -	struct ceph_osd_request *req = container_of(kref,
> -						    struct ceph_osd_request,
> -						    r_kref);
> +	struct ceph_osd_request *req;
>
> +	req = container_of(kref, struct ceph_osd_request, r_kref);
>   	if (req->r_request)
>   		ceph_msg_put(req->r_request);
>   	if (req->r_reply) {
> @@ -128,18 +146,8 @@ void ceph_osdc_release_request(struct kref *kref)
>   		ceph_msg_put(req->r_reply);
>   	}
>
> -	if (req->r_data_in.type == CEPH_OSD_DATA_TYPE_PAGES &&
> -			req->r_data_in.own_pages) {
> -		num_pages = calc_pages_for((u64)req->r_data_in.alignment,
> -						(u64)req->r_data_in.length);
> -		ceph_release_page_vector(req->r_data_in.pages, num_pages);
> -	}
> -	if (req->r_data_out.type == CEPH_OSD_DATA_TYPE_PAGES &&
> -			req->r_data_out.own_pages) {
> -		num_pages = calc_pages_for((u64)req->r_data_out.alignment,
> -						(u64)req->r_data_out.length);
> -		ceph_release_page_vector(req->r_data_out.pages, num_pages);
> -	}
> +	ceph_osd_data_release(&req->r_data_in);
> +	ceph_osd_data_release(&req->r_data_out);
>
>   	ceph_put_snap_context(req->r_snapc);
>   	if (req->r_mempool)
> @@ -203,8 +211,8 @@ struct ceph_osd_request
> *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
>   	}
>   	req->r_reply = msg;
>
> -	req->r_data_in.type = CEPH_OSD_DATA_TYPE_NONE;
> -	req->r_data_out.type = CEPH_OSD_DATA_TYPE_NONE;
> +	ceph_osd_data_init(&req->r_data_in);
> +	ceph_osd_data_init(&req->r_data_out);
>
>   	/* create request message; allow space for oid */
>   	if (use_mempool)
>


  reply	other threads:[~2013-04-05 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 [this message]
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
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=515F1522.5030402@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.