CEPH filesystem development
 help / color / mirror / Atom feed
From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 2/5] rbd: support data returned from OSD methods
Date: Tue, 11 Sep 2012 08:16:56 -0700	[thread overview]
Message-ID: <504F55E8.8000004@inktank.com> (raw)
In-Reply-To: <504A3AA9.80004@inktank.com>

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

On 09/07/2012 11:19 AM, Alex Elder wrote:
> An OSD object method call can be made using rbd_req_sync_exec().
> Until now this has only been used for creating a new RBD snapshot,
> and that has only required sending data out, not receiving anything
> back from the OSD.
>
> We will now need to get data back from an OSD on a method call, so
> add parameters to rbd_req_sync_exec() that allow a buffer into which
> returned data should be placed to be specified, along with its size.
>
> Previously, rbd_req_sync_exec() passed a null pointer and zero
> size to rbd_req_sync_op(); change this so the new inbound buffer
> information is provided instead.
>
> Rename the "buf" and "len" parameters in rbd_req_sync_op() to
> make it more obvious they are describing inbound data.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   19 +++++++++++--------
>   1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 4e84f99..ba68566 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1098,8 +1098,8 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
>   			   int flags,
>   			   struct ceph_osd_req_op *ops,
>   			   const char *object_name,
> -			   u64 ofs, u64 len,
> -			   char *buf,
> +			   u64 ofs, u64 inbound_size,
> +			   char *inbound,
>   			   struct ceph_osd_request **linger_req,
>   			   u64 *ver)
>   {
> @@ -1109,13 +1109,13 @@ static int rbd_req_sync_op(struct rbd_device
> *rbd_dev,
>
>   	rbd_assert(ops != NULL);
>
> -	num_pages = calc_pages_for(ofs , len);
> +	num_pages = calc_pages_for(ofs, inbound_size);
>   	pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL);
>   	if (IS_ERR(pages))
>   		return PTR_ERR(pages);
>
>   	ret = rbd_do_request(NULL, rbd_dev, snapc, snapid,
> -			  object_name, ofs, len, NULL,
> +			  object_name, ofs, inbound_size, NULL,
>   			  pages, num_pages,
>   			  flags,
>   			  ops,
> @@ -1125,8 +1125,8 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
>   	if (ret < 0)
>   		goto done;
>
> -	if ((flags & CEPH_OSD_FLAG_READ) && buf)
> -		ret = ceph_copy_from_page_vector(pages, buf, ofs, ret);
> +	if ((flags & CEPH_OSD_FLAG_READ) && inbound)
> +		ret = ceph_copy_from_page_vector(pages, inbound, ofs, ret);
>
>   done:
>   	ceph_release_page_vector(pages, num_pages);
> @@ -1445,6 +1445,8 @@ static int rbd_req_sync_exec(struct rbd_device
> *rbd_dev,
>   			     const char *method_name,
>   			     const char *outbound,
>   			     size_t outbound_size,
> +			     char *inbound,
> +			     size_t inbound_size,
>   			     int flags,
>   			     u64 *ver)
>   {
> @@ -1478,7 +1480,8 @@ static int rbd_req_sync_exec(struct rbd_device
> *rbd_dev,
>   	ret = rbd_req_sync_op(rbd_dev, NULL,
>   			       CEPH_NOSNAP,
>   			       flags, ops,
> -			       object_name, 0, 0, NULL, NULL, ver);
> +			       object_name, 0, inbound_size, inbound,
> +			       NULL, ver);
>
>   	rbd_destroy_ops(ops);
>
> @@ -1789,7 +1792,7 @@ static int rbd_header_add_snap(struct rbd_device
> *rbd_dev,
>
>   	ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
>   				"rbd", "snap_add",
> -				data, (size_t) (p - data),
> +				data, (size_t) (p - data), NULL, 0,
>   				CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
>   				NULL);
>


  reply	other threads:[~2012-09-11 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07 18:16 [PATCH 0/5] rbd: kill create_snap sysfs entry Alex Elder
2012-09-07 18:19 ` [PATCH 1/5] rbd: pass flags to rbd_req_sync_exec() Alex Elder
2012-09-11 15:14   ` Josh Durgin
2012-09-07 18:19 ` [PATCH 2/5] rbd: support data returned from OSD methods Alex Elder
2012-09-11 15:16   ` Josh Durgin [this message]
2012-09-07 18:19 ` [PATCH 3/5] rbd: define some new format constants Alex Elder
2012-09-11 15:18   ` Josh Durgin
2012-09-07 18:19 ` [PATCH 4/5] rbd: define rbd_dev_image_id() Alex Elder
2012-09-11 15:50   ` Josh Durgin
2012-09-07 18:19 ` [PATCH 5/5] rbd: kill create_snap sysfs entry Alex Elder
2012-09-11 20:53   ` 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=504F55E8.8000004@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox