From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 4/9] rbd: read the header before registering device
Date: Tue, 11 Sep 2012 08:02:52 -0700 [thread overview]
Message-ID: <504F529C.10602@inktank.com> (raw)
In-Reply-To: <504A1674.70407@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
On 09/07/2012 08:44 AM, Alex Elder wrote:
> Read the rbd header information and call rbd_dev_set_mapping()
> earlier--before registering the block device or setting up the sysfs
> entries for the image. The sysfs entries provide users access to
> some information that's only available after doing the rbd header
> initialization, so this will make sure it's valid right away.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
> drivers/block/rbd.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index d60db25..89d8ed7 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2598,10 +2598,24 @@ static ssize_t rbd_add(struct bus_type *bus,
> goto err_out_client;
> sprintf(rbd_dev->header_name, "%s%s", rbd_dev->image_name, RBD_SUFFIX);
>
> + /* Get information about the image being mapped */
> +
> + rc = rbd_read_header(rbd_dev, &rbd_dev->header);
> + if (rc)
> + goto err_out_client;
> +
> + rc = rbd_dev_snaps_update(rbd_dev);
> + if (rc)
> + goto err_out_header;
> +
> + rc = rbd_dev_set_mapping(rbd_dev, snap_name);
> + if (rc)
> + goto err_out_header;
> +
> /* register our block device */
> rc = register_blkdev(0, rbd_dev->name);
> if (rc < 0)
> - goto err_out_client;
> + goto err_out_header;
> rbd_dev->major = rc;
>
> rc = rbd_bus_add_dev(rbd_dev);
> @@ -2613,19 +2627,6 @@ static ssize_t rbd_add(struct bus_type *bus,
> * of the sysfs code (initiated by rbd_bus_del_dev()).
> */
>
> - /* contact OSD, request size info about the object being mapped */
> - rc = rbd_read_header(rbd_dev, &rbd_dev->header);
> - if (rc)
> - goto err_out_unlock;
> -
> - rc = rbd_dev_snaps_update(rbd_dev);
> - if (rc)
> - goto err_out_unlock;
> -
> - rc = rbd_dev_set_mapping(rbd_dev, snap_name);
> - if (rc)
> - goto err_out_unlock;
> -
> rc = rbd_dev_snaps_register(rbd_dev);
> if (rc)
> goto err_out_unlock;
> @@ -2662,6 +2663,8 @@ err_out_bus:
>
> err_out_blkdev:
> unregister_blkdev(rbd_dev->major, rbd_dev->name);
> +err_out_header:
> + rbd_header_free(&rbd_dev->header);
> err_out_client:
> kfree(rbd_dev->header_name);
> rbd_put_client(rbd_dev);
>
next prev parent reply other threads:[~2012-09-11 15:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 15:39 [PATCH 0/9] rbd: rearrange initialization sequence Alex Elder
2012-09-07 15:44 ` [PATCH 1/9] rbd: assign header name later Alex Elder
2012-09-10 22:41 ` Josh Durgin
2012-09-07 15:44 ` [PATCH 2/9] rbd: defer registering snapshot devices Alex Elder
2012-09-11 14:56 ` Josh Durgin
2012-09-07 15:44 ` [PATCH 3/9] rbd: call set_snap() before snap_devs_update() Alex Elder
2012-09-11 14:58 ` Josh Durgin
2012-09-07 15:44 ` [PATCH 4/9] rbd: read the header before registering device Alex Elder
2012-09-11 15:02 ` Josh Durgin [this message]
2012-09-07 15:45 ` [PATCH 5/9] rbd: defer setting device id Alex Elder
2012-09-11 15:03 ` Josh Durgin
2012-09-07 15:45 ` [PATCH 6/9] rbd: call rbd_init_disk() sooner Alex Elder
2012-09-11 15:06 ` Josh Durgin
2012-09-07 15:45 ` [PATCH 7/9] rbd: drop dev registration check for new snap Alex Elder
2012-09-11 15:07 ` Josh Durgin
2012-09-07 15:45 ` [PATCH 8/9] rbd: set initial capacity in rbd_init_disk() Alex Elder
2012-09-11 15:07 ` Josh Durgin
2012-09-07 15:45 ` [PATCH 9/9] rbd: set up watch before announcing disk Alex Elder
2012-09-11 15:08 ` Josh Durgin
2012-09-07 15:50 ` [PATCH 0/9] rbd: rearrange initialization sequence 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=504F529C.10602@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.