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 <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 2/4] rbd: encapsulate submission of image object requests
Date: Mon, 22 Apr 2013 00:35:33 -0700	[thread overview]
Message-ID: <5174E845.8010900@inktank.com> (raw)
In-Reply-To: <5171CA1A.6010908@inktank.com>

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

On 04/19/2013 03:50 PM, Alex Elder wrote:
> Object requests that are part of an image request are subject to
> some additional handling.  Define rbd_img_obj_request_submit() to
> encapsulate that, and use it when initially submitting an image
> object request, and when re-submitting it during callback of
> an object existence check.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   65
> ++++++++++++++++++++++++++++++++++-----------------
>   1 file changed, 43 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index a185239..894af4f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -423,6 +423,7 @@ void rbd_warn(struct rbd_device *rbd_dev, const char
> *fmt, ...)
>   #endif /* !RBD_DEBUG */
>
>   static void rbd_img_parent_read(struct rbd_obj_request *obj_request);
> +static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request);
>
>   static int rbd_dev_refresh(struct rbd_device *rbd_dev, u64 *hver);
>   static int rbd_dev_v2_refresh(struct rbd_device *rbd_dev, u64 *hver);
> @@ -1874,8 +1875,6 @@ out_unwind:
>
>   static void rbd_img_obj_exists_callback(struct rbd_obj_request
> *obj_request)
>   {
> -	struct rbd_device *rbd_dev;
> -	struct ceph_osd_client *osdc;
>   	struct rbd_obj_request *orig_request;
>   	int result;
>
> @@ -1901,8 +1900,6 @@ static void rbd_img_obj_exists_callback(struct
> rbd_obj_request *obj_request)
>
>   	rbd_assert(orig_request);
>   	rbd_assert(orig_request->img_request);
> -	rbd_dev = orig_request->img_request->rbd_dev;
> -	osdc = &rbd_dev->rbd_client->client->osdc;
>
>   	/*
>   	 * Our only purpose here is to determine whether the object
> @@ -1923,7 +1920,7 @@ static void rbd_img_obj_exists_callback(struct
> rbd_obj_request *obj_request)
>   	 * Resubmit the original request now that we have recorded
>   	 * whether the target object exists.
>   	 */
> -	orig_request->result = rbd_obj_request_submit(osdc, orig_request);
> +	orig_request->result = rbd_img_obj_request_submit(orig_request);
>   out_err:
>   	if (orig_request->result)
>   		rbd_obj_request_complete(orig_request);
> @@ -1987,32 +1984,56 @@ out:
>   	return ret;
>   }
>
> +static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
> +{
> +	struct rbd_img_request *img_request;
> +
> +	rbd_assert(obj_request_img_data_test(obj_request));
> +
> +	img_request = obj_request->img_request;
> +	rbd_assert(img_request);
> +
> +	/* (At the moment we don't care whether it exists or not...) */
> +	(void) obj_request_exists_test;
> +
> +	/*
> +	 * Only layered writes need special handling.  If it's not a
> +	 * layered write, or it is a layered write but we know the
> +	 * target object exists, it's no different from any other
> +	 * object request.
> +	 */
> +	if (!img_request_write_test(img_request) ||
> +		!img_request_layered_test(img_request) ||
> +		obj_request_known_test(obj_request)) {
> +
> +		struct rbd_device *rbd_dev;
> +		struct ceph_osd_client *osdc;
> +
> +		rbd_dev = obj_request->img_request->rbd_dev;
> +		osdc = &rbd_dev->rbd_client->client->osdc;
> +
> +		return rbd_obj_request_submit(osdc, obj_request);
> +	}
> +
> +	/*
> +	 * It's a layered write and we don't know whether the target
> +	 * exists.  Issue existence check; once that completes the
> +	 * original request will be submitted again.
> +	 */
> +
> +	return rbd_img_obj_exists_submit(obj_request);
> +}
> +
>   static int rbd_img_request_submit(struct rbd_img_request *img_request)
>   {
> -	struct rbd_device *rbd_dev = img_request->rbd_dev;
> -	struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
>   	struct rbd_obj_request *obj_request;
>   	struct rbd_obj_request *next_obj_request;
> -	bool write_request = img_request_write_test(img_request);
> -	bool layered = img_request_layered_test(img_request);
>
>   	dout("%s: img %p\n", __func__, img_request);
>   	for_each_obj_request_safe(img_request, obj_request, next_obj_request) {
> -		bool known;
> -		bool object_exists;
>   		int ret;
>
> -		/*
> -		 * We need to know whether the target object exists
> -		 * for a layered write.  Issue an existence check
> -		 * first if we need to.
> -		 */
> -		known = obj_request_known_test(obj_request);
> -		object_exists = known && obj_request_exists_test(obj_request);
> -		if (!write_request || !layered || object_exists)
> -			ret = rbd_obj_request_submit(osdc, obj_request);
> -		else
> -			ret = rbd_img_obj_exists_submit(obj_request);
> +		ret = rbd_img_obj_request_submit(obj_request);
>   		if (ret)
>   			return ret;
>   	}
>


  reply	other threads:[~2013-04-22  7:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19 22:46 [PATCH 0] rbd: layered writes Alex Elder
2013-04-19 22:49 ` [PATCH] libceph: fix two messenger bugs Alex Elder
2013-04-22  7:14   ` Josh Durgin
2013-04-19 22:49 ` [PATCH] libceph: support pages for class request data Alex Elder
2013-04-22  7:15   ` Josh Durgin
2013-04-19 22:49 ` [PATCH 1/4] rbd: define separate read and write format funcs Alex Elder
2013-04-22  7:23   ` Josh Durgin
2013-04-19 22:50 ` [PATCH 2/4] rbd: encapsulate submission of image object requests Alex Elder
2013-04-22  7:35   ` Josh Durgin [this message]
2013-04-19 22:50 ` [PATCH 3/4] rbd: define zero_pages() Alex Elder
2013-04-22  8:05   ` Josh Durgin
2013-04-22 12:35     ` Alex Elder
2013-04-19 22:50 ` [PATCH 4/4] rbd: support page array image requests Alex Elder
2013-04-22  8:13   ` Josh Durgin
2013-04-19 22:50 ` [PATCH 1/2] rbd: implement full object parent reads Alex Elder
2013-04-22 18:13   ` Josh Durgin
2013-04-19 22:50 ` [PATCH 2/2] rbd: issue a copyup for layered writes Alex Elder
2013-04-22 18:16   ` Josh Durgin
2013-04-19 22:52 ` [PATCH 0] rbd: " Alex Elder

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=5174E845.8010900@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.