CEPH filesystem development
 help / color / mirror / Atom feed
From: Alex Elder <alex.elder@linaro.org>
To: Josh Durgin <josh.durgin@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] rbd: use the correct length for format 2 object names
Date: Sat, 15 Jun 2013 12:05:20 -0500	[thread overview]
Message-ID: <51BC9ED0.3000503@linaro.org> (raw)
In-Reply-To: <1371093046-5814-2-git-send-email-josh.durgin@inktank.com>

On 06/12/2013 10:10 PM, Josh Durgin wrote:
> Format 2 objects use 16 characters for the object name suffix to be
> able to express the full 64-bit range of object numbers. Format 1
> images only use 12 characters for this. Using 12-character names for
> format 2 caused userspace and kernel rbd clients to read differently
> named objects, which made an image written by one client look empty to
> the other client.
> 
> Reported-by: Chris Dunlop <chris@onthe.net.au>
> Signed-off-by: Josh Durgin <josh.durgin@inktank.com>

Looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

>  drivers/block/rbd.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 9f72125..39ee017 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1028,12 +1028,16 @@ static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset)
>  	char *name;
>  	u64 segment;
>  	int ret;
> +	char *name_format;
>  
>  	name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO);
>  	if (!name)
>  		return NULL;
>  	segment = offset >> rbd_dev->header.obj_order;
> -	ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx",
> +	name_format = "%s.%012llx";
> +	if (rbd_dev->image_format == 2)
> +		name_format = "%s.%016llx";
> +	ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, name_format,
>  			rbd_dev->header.object_prefix, segment);
>  	if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) {
>  		pr_err("error formatting segment name for #%llu (%d)\n",
> 


  reply	other threads:[~2013-06-15 17:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-13  3:10 [PATCH 1/2] rbd: fetch object order before using it Josh Durgin
2013-06-13  3:10 ` [PATCH 2/2] rbd: use the correct length for format 2 object names Josh Durgin
2013-06-15 17:05   ` Alex Elder [this message]
2013-06-13 15:52 ` [PATCH 1/2] rbd: fetch object order before using it Sage Weil
2013-06-15 17:05 ` 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=51BC9ED0.3000503@linaro.org \
    --to=alex.elder@linaro.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=josh.durgin@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