From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 4/6] rbd: don't look up snapshot id in rbd_dev_mapping_set()
Date: Mon, 06 May 2013 20:38:04 -0500 [thread overview]
Message-ID: <51885AFC.3050908@inktank.com> (raw)
In-Reply-To: <51885A97.9070005@inktank.com>
Currently rbd_dev_mapping_set() looks up the snapshot id for the
snapshot whose name is found in the rbd device's spec structure.
That function gets called by rbd_dev_device_setup(), which is
called by rbd_add() *after* rbd_dev_image_probe(). If the
image probe succeeds, the rbd device's spec will already have
been updated to include names and ids for all fields.
Therefore there's no need to look up the snapshot id in
rbd_dev_mapping_set().
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 7d93dbd..5eebf6d 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -936,20 +936,11 @@ static int rbd_snap_features(struct rbd_device
*rbd_dev, u64 snap_id,
static int rbd_dev_mapping_set(struct rbd_device *rbd_dev)
{
- const char *snap_name = rbd_dev->spec->snap_name;
- u64 snap_id;
+ u64 snap_id = rbd_dev->spec->snap_id;
u64 size = 0;
u64 features = 0;
int ret;
- if (strcmp(snap_name, RBD_SNAP_HEAD_NAME)) {
- snap_id = rbd_snap_id_by_name(rbd_dev, snap_name);
- if (snap_id == CEPH_NOSNAP)
- return -ENOENT;
- } else {
- snap_id = CEPH_NOSNAP;
- }
-
ret = rbd_snap_size(rbd_dev, snap_id, &size);
if (ret)
return ret;
--
1.7.9.5
next prev parent reply other threads:[~2013-05-07 1:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 1:36 [PATCH 0/6] rbd: miscellaneous cleanups Alex Elder
2013-05-07 1:37 ` [PATCH 1/6] rbd: update capacity in rbd_dev_refresh() Alex Elder
2013-05-07 22:49 ` Josh Durgin
2013-05-07 1:37 ` [PATCH 2/6] rbd: kill rbd_update_mapping_size() Alex Elder
2013-05-07 14:56 ` Josh Durgin
2013-05-07 15:41 ` Alex Elder
2013-05-07 1:37 ` [PATCH 3/6] rbd: don't print warning if not mapping a parent Alex Elder
2013-05-07 14:21 ` Josh Durgin
2013-05-07 1:38 ` Alex Elder [this message]
2013-05-07 14:26 ` [PATCH 4/6] rbd: don't look up snapshot id in rbd_dev_mapping_set() Josh Durgin
2013-05-07 1:38 ` [PATCH 5/6] rbd: kill rbd_dev_clear_mapping() Alex Elder
2013-05-07 14:26 ` Josh Durgin
2013-05-07 1:38 ` [PATCH 6/6] rbd: always set read-only flag in rbd_add() Alex Elder
2013-05-07 22:51 ` Josh Durgin
2013-05-08 12:50 ` 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=51885AFC.3050908@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/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.