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" <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 3/4] rbd: decrement obj request count when deleting
Date: Wed, 30 Jan 2013 11:30:54 -0800	[thread overview]
Message-ID: <510974EE.1040305@inktank.com> (raw)
In-Reply-To: <51043F64.6020800@inktank.com>

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

On 01/26/2013 12:41 PM, Alex Elder wrote:
> Decrement the obj_request_count value when deleting an object
> request from its image request's list.  Rearrange a few lines
> in the surrounding code.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   16 ++++++++++++----
>   1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 4e78402..340773f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1071,22 +1071,29 @@ static void rbd_img_request_put(struct
> rbd_img_request *img_request)
>   static inline void rbd_img_obj_request_add(struct rbd_img_request
> *img_request,
>   					struct rbd_obj_request *obj_request)
>   {
> +	rbd_assert(obj_request->img_request == NULL);
> +
>   	rbd_obj_request_get(obj_request);
>   	obj_request->img_request = img_request;
> -	list_add_tail(&obj_request->links, &img_request->obj_requests);
> -	obj_request->which = img_request->obj_request_count++;
> +	obj_request->which = img_request->obj_request_count;
>   	rbd_assert(obj_request->which != BAD_WHICH);
> +	img_request->obj_request_count++;
> +	list_add_tail(&obj_request->links, &img_request->obj_requests);
>   }
>
>   static inline void rbd_img_obj_request_del(struct rbd_img_request
> *img_request,
>   					struct rbd_obj_request *obj_request)
>   {
>   	rbd_assert(obj_request->which != BAD_WHICH);
> -	obj_request->which = BAD_WHICH;
> +
>   	list_del(&obj_request->links);
> +	rbd_assert(img_request->obj_request_count > 0);
> +	img_request->obj_request_count--;
> +	rbd_assert(obj_request->which == img_request->obj_request_count);
> +	obj_request->which = BAD_WHICH;
>   	rbd_assert(obj_request->img_request == img_request);
> -	obj_request->callback = NULL;
>   	obj_request->img_request = NULL;
> +	obj_request->callback = NULL;
>   	rbd_obj_request_put(obj_request);
>   }
>
> @@ -1482,6 +1489,7 @@ static void rbd_img_request_destroy(struct kref *kref)
>
>   	for_each_obj_request_safe(img_request, obj_request, next_obj_request)
>   		rbd_img_obj_request_del(img_request, obj_request);
> +	rbd_assert(img_request->obj_request_count == 0);
>
>   	if (img_request->write_request)
>   		ceph_put_snap_context(img_request->snapc);
>


  reply	other threads:[~2013-01-30 19:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-26 20:39 [PATCH 0/4] rbd: keep reference to lingering object requests Alex Elder
2013-01-26 20:40 ` [PATCH 1/4] rbd: unregister linger in watch sync routine Alex Elder
2013-01-30 19:30   ` Josh Durgin
2013-01-26 20:40 ` [PATCH 2/4] rbd: track object rather than osd request for watch Alex Elder
2013-01-30 19:30   ` Josh Durgin
2013-01-26 20:41 ` [PATCH 3/4] rbd: decrement obj request count when deleting Alex Elder
2013-01-30 19:30   ` Josh Durgin [this message]
2013-01-26 20:41 ` [PATCH 4/4] rbd: don't drop watch requests on completion Alex Elder
2013-01-30 19:43   ` Josh Durgin
2013-01-30 20:38     ` Alex Elder
2013-01-30 20:39       ` Josh Durgin
2013-01-30 21:54         ` 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=510974EE.1040305@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