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 7/9] rbd: update remaining header fields for v2
Date: Wed, 19 Sep 2012 12:38:08 -0700	[thread overview]
Message-ID: <505A1F20.8040301@inktank.com> (raw)
In-Reply-To: <504A63ED.5070008@inktank.com>

On 09/07/2012 02:15 PM, Alex Elder wrote:
> There are three fields that are not yet updated for format 2 rbd
> image headers:  the version of the header object; the encryption
> type; and the compression type.  There is no interface defined for
> fetching the latter two, so just initialize them explicitly to 0 for
> now.

Encryption and compression type are never actually used, even for
format 1 images. They were just placeholders.

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

> Change rbd_dev_v2_snap_context() so the caller can be supplied the
> version for the header object.
>
> 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 c6922a1..ad27be2 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2235,7 +2235,7 @@ static int rbd_dev_v2_features(struct rbd_device
> *rbd_dev)
>   						&rbd_dev->header.features);
>   }
>
> -static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev)
> +static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev, u64 *ver)
>   {
>   	size_t size;
>   	int ret;
> @@ -2263,7 +2263,7 @@ static int rbd_dev_v2_snap_context(struct
> rbd_device *rbd_dev)
>   				"rbd", "get_snapcontext",
>   				NULL, 0,
>   				reply_buf, size,
> -				CEPH_OSD_FLAG_READ, NULL);
> +				CEPH_OSD_FLAG_READ, ver);
>   	dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
>   	if (ret < 0)
>   		goto out;
> @@ -2899,6 +2899,7 @@ static int rbd_dev_v2_probe(struct rbd_device
> *rbd_dev)
>   {
>   	size_t size;
>   	int ret;
> +	u64 ver = 0;
>
>   	/*
>   	 * Image id was filled in by the caller.  Record the header
> @@ -2929,11 +2930,18 @@ static int rbd_dev_v2_probe(struct rbd_device
> *rbd_dev)
>   	if (ret < 0)
>   		goto out_err;
>
> -	/* Get the snapshot context */
> +	/* crypto and compression type aren't (yet) supported for v2 images */
> +
> +	rbd_dev->header.crypt_type = 0;
> +	rbd_dev->header.comp_type = 0;
>
> -	ret = rbd_dev_v2_snap_context(rbd_dev);
> +	/* Get the snapshot context, plus the header version */
> +
> +	ret = rbd_dev_v2_snap_context(rbd_dev, &ver);
>   	if (ret)
>   		goto out_err;
> +	rbd_dev->header.obj_version = ver;
> +
>   	rbd_dev->image_format = 2;
>
>   	dout("discovered version 2 image, header name is %s\n",
>


  reply	other threads:[~2012-09-19 19:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07 21:09 [PATCH 0/9] rbd: activate v2 image support Alex Elder
2012-09-07 21:13 ` [PATCH 1/9] rbd: lay out header probe infrastructure Alex Elder
2012-09-19 18:35   ` Josh Durgin
2012-09-07 21:13 ` [PATCH 2/9] rbd: add code to get the size of a v2 rbd image Alex Elder
2012-09-19 18:52   ` Josh Durgin
2012-09-07 21:13 ` [PATCH 3/9] rbd: get the object prefix for " Alex Elder
2012-09-19 18:57   ` Josh Durgin
2012-09-07 21:13 ` [PATCH 4/9] rbd: get image features for a v2 image Alex Elder
2012-09-19 19:02   ` Josh Durgin
2012-09-07 21:13 ` [PATCH 5/9] rbd: get the snapshot context " Alex Elder
2012-09-19 19:17   ` Josh Durgin
2012-09-07 21:14 ` [PATCH 6/9] rbd: get snapshot name " Alex Elder
2012-09-19 19:31   ` Josh Durgin
2012-09-07 21:15 ` [PATCH 7/9] rbd: update remaining header fields for v2 Alex Elder
2012-09-19 19:38   ` Josh Durgin [this message]
2012-09-07 21:15 ` [PATCH 8/9] rbd: define rbd_dev_v2_snapc_refresh() Alex Elder
2012-09-19 21:00   ` Josh Durgin
2012-09-07 21:15 ` [PATCH 9/9] rbd: activate v2 image support Alex Elder
2012-09-19 19:56   ` Josh Durgin
2012-09-19 19:57     ` 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=505A1F20.8040301@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