From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 3/4] rbd: don't register snapshots in bus_add_dev()
Date: Mon, 10 Sep 2012 15:21:35 -0700 [thread overview]
Message-ID: <504E67EF.3020105@inktank.com> (raw)
In-Reply-To: <504A09B4.3080909@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
On 09/07/2012 07:50 AM, Alex Elder wrote:
> When rbd_bus_add_dev() is called (one spot--in rbd_add()), the rbd
> image header has not even been read yet. This means that the list
> of snapshots will be empty at the time of the call. As a result,
> there is no need for the code that calls rbd_register_snap_dev()
> for each entry in that list--so get rid of it.
>
> Once the header has been read (just after returning), a call will
> be made to rbd_dev_snap_devs_update(), which will then find every
> snapshot in the context to be new and will therefore call
> rbd_register_snap_dev() via __rbd_add_snap_dev() accomplishing
> the same thing.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
> drivers/block/rbd.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 6af09f1..e922989 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2244,29 +2244,21 @@ static int rbd_dev_snap_devs_update(struct
> rbd_device *rbd_dev)
>
> static int rbd_bus_add_dev(struct rbd_device *rbd_dev)
> {
> - int ret;
> struct device *dev;
> - struct rbd_snap *snap;
> + int ret;
>
> mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
> - dev = &rbd_dev->dev;
>
> + dev = &rbd_dev->dev;
> dev->bus = &rbd_bus_type;
> dev->type = &rbd_device_type;
> dev->parent = &rbd_root_dev;
> dev->release = rbd_dev_release;
> dev_set_name(dev, "%d", rbd_dev->dev_id);
> ret = device_register(dev);
> - if (ret < 0)
> - goto out;
>
> - list_for_each_entry(snap, &rbd_dev->snaps, node) {
> - ret = rbd_register_snap_dev(snap, &rbd_dev->dev);
> - if (ret < 0)
> - break;
> - }
> -out:
> mutex_unlock(&ctl_mutex);
> +
> return ret;
> }
>
next prev parent reply other threads:[~2012-09-10 22:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 14:47 [PATCH 0/4] rbd: locking, snapshot registration, snap_by_name() Alex Elder
2012-09-07 14:50 ` [PATCH 1/4] rbd: move locking out of rbd_header_set_snap() Alex Elder
2012-09-10 21:57 ` Josh Durgin
2012-09-07 14:50 ` [PATCH 2/4] rbd: expand lock protection in rbd_add() Alex Elder
2012-09-10 22:05 ` Josh Durgin
2012-09-11 13:52 ` Alex Elder
2012-09-11 14:33 ` Josh Durgin
2012-09-07 14:50 ` [PATCH 3/4] rbd: don't register snapshots in bus_add_dev() Alex Elder
2012-09-10 22:21 ` Josh Durgin [this message]
2012-09-07 14:50 ` [PATCH 4/4] rbd: use snaps list in rbd_snap_by_name() Alex Elder
2012-09-10 22:32 ` Josh Durgin
2012-09-11 14: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=504E67EF.3020105@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