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/2] rbd: rename snap_exists field
Date: Mon, 29 Oct 2012 13:46:45 -0700	[thread overview]
Message-ID: <508EEB35.90106@inktank.com> (raw)
In-Reply-To: <508B13FA.7060407@inktank.com>

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

On 10/26/2012 03:51 PM, Alex Elder wrote:
> A Boolean field "snap_exists" in an rbd mapping is used to indicate
> whether a mapped snapshot has been removed from an image's snapshot
> context, to stop sending requests for that snapshot as soon as we
> know it's gone.
>
> Generalize the interpretation of this field so it applies to
> non-snapshot (i.e. "head") mappings.  That is, define its value
> to be false until the mapping has been set, and then define it to be
> true for both snapshot mappings or head mappings.
>
> Rename the field "exists" to reflect the broader interpretation.
> The rbd_mapping structure is on its way out, so move the field
> back into the rbd_device structure.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 05525b2..fb44d4d 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -168,7 +168,6 @@ struct rbd_snap {
>   struct rbd_mapping {
>   	u64                     size;
>   	u64                     features;
> -	bool                    snap_exists;
>   	bool			read_only;
>   };
>
> @@ -189,6 +188,7 @@ struct rbd_device {
>   	spinlock_t		lock;		/* queue lock */
>
>   	struct rbd_image_header	header;
> +	bool                    exists;
>   	char			*image_id;
>   	size_t			image_id_len;
>   	char			*image_name;
> @@ -690,16 +690,15 @@ static int rbd_dev_set_mapping(struct rbd_device
> *rbd_dev, char *snap_name)
>   		rbd_dev->snap_id = CEPH_NOSNAP;
>   		rbd_dev->mapping.size = rbd_dev->header.image_size;
>   		rbd_dev->mapping.features = rbd_dev->header.features;
> -		rbd_dev->mapping.snap_exists = false;
>   		ret = 0;
>   	} else {
>   		ret = snap_by_name(rbd_dev, snap_name);
>   		if (ret < 0)
>   			goto done;
> -		rbd_dev->mapping.snap_exists = true;
>   		rbd_dev->mapping.read_only = true;
>   	}
>   	rbd_dev->snap_name = snap_name;
> +	rbd_dev->exists = true;
>   done:
>   	return ret;
>   }
> @@ -1562,8 +1561,8 @@ static void rbd_rq_fn(struct request_queue *q)
>
>   		down_read(&rbd_dev->header_rwsem);
>
> -		if (rbd_dev->snap_id != CEPH_NOSNAP &&
> -				!rbd_dev->mapping.snap_exists) {
> +		if (!rbd_dev->exists) {
> +			rbd_assert(rbd_dev->snap_id != CEPH_NOSNAP);
>   			up_read(&rbd_dev->header_rwsem);
>   			dout("request for non-existent snapshot");
>   			spin_lock_irq(q->queue_lock);
> @@ -2569,7 +2568,7 @@ static int rbd_dev_snaps_update(struct rbd_device
> *rbd_dev)
>   			/* Existing snapshot not in the new snap context */
>
>   			if (rbd_dev->snap_id == snap->id)
> -				rbd_dev->mapping.snap_exists = false;
> +				rbd_dev->exists = false;
>   			__rbd_remove_snap_dev(snap);
>   			dout("%ssnap id %llu has been removed\n",
>   				rbd_dev->snap_id == snap->id ?  "mapped " : "",
>


  reply	other threads:[~2012-10-29 20:46 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26 22:42 Another pile of patches Alex Elder
2012-10-26 22:44 ` [PATCH, resend] rbd: simplify rbd_rq_fn() Alex Elder
2012-10-29 20:29   ` Josh Durgin
2012-10-30 12:01     ` Alex Elder
2012-10-26 22:45 ` [PATCH] rbd: remove snapshots on error in rbd_add() Alex Elder
2012-10-29 20:36   ` Josh Durgin
2012-10-26 22:45 ` [PATCH] rbd: make pool_id a 64 bit value Alex Elder
2012-10-29 20:40   ` Josh Durgin
2012-10-26 22:48 ` [PATCH 0/2] rbd: mapping structure changes Alex Elder
2012-10-26 22:51   ` [PATCH 1/2] rbd: move snap info out of rbd_mapping struct Alex Elder
2012-10-29 20:43     ` Josh Durgin
2012-10-26 22:51   ` [PATCH 2/2] rbd: rename snap_exists field Alex Elder
2012-10-29 20:46     ` Josh Durgin [this message]
2012-10-26 22:52 ` [PATCH 0/2] rbd: consolidate argument parsing Alex Elder
2012-10-26 22:55   ` [PATCH 1/2] rbd: move ceph_parse_options() call up Alex Elder
2012-10-29 21:08     ` Josh Durgin
2012-10-26 22:55   ` [PATCH 2/2] rbd: do all argument parsing in one place Alex Elder
2012-10-29 21:13     ` Josh Durgin
2012-10-26 22:56 ` [PATCH 0/8] rbd: have rbd_add_parse_args() only parse args Alex Elder
2012-10-26 23:00   ` [PATCH 1/8] rbd: get rid of snap_name_len Alex Elder
2012-10-29 21:14     ` Josh Durgin
2012-10-26 23:00   ` [PATCH 2/8] rbd: remove options args from rbd_add_parse_args() Alex Elder
2012-10-29 21:17     ` Josh Durgin
2012-10-26 23:01   ` [PATCH 3/8] rbd: remove snap_name arg " Alex Elder
2012-10-29 21:26     ` Josh Durgin
2012-10-26 23:02   ` [PATCH 4/8] rbd: pass and populate rbd_options structure Alex Elder
2012-10-29 21:27     ` Josh Durgin
2012-10-26 23:02   ` [PATCH 5/8] rbd: have rbd_add_parse_args() return error Alex Elder
2012-10-29 21:28     ` Josh Durgin
2012-10-26 23:03   ` [PATCH 6/8] rbd: define image specification structure Alex Elder
2012-10-29 22:13     ` Josh Durgin
2012-10-30 12:40       ` Alex Elder
2012-10-30 20:13         ` Josh Durgin
2012-10-26 23:03   ` [PATCH 7/8] rbd: add reference counting to rbd_spec Alex Elder
2012-10-29 22:20     ` Josh Durgin
2012-10-30 12:59       ` Alex Elder
2012-10-30 20:17         ` Josh Durgin
2012-10-26 23:03   ` [PATCH 8/8] rbd: fill rbd_spec in rbd_add_parse_args() Alex Elder
2012-10-29 22:30     ` Josh Durgin
2012-10-30 13:09       ` Alex Elder
2012-10-30 20:18         ` 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=508EEB35.90106@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