Commit 8f4b7d98 authored by Alex Elder's avatar Alex Elder

rbd: don't look up snapshot id in rbd_dev_mapping_set()

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: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent c734b796
...@@ -936,20 +936,11 @@ static int rbd_snap_features(struct rbd_device *rbd_dev, u64 snap_id, ...@@ -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) static int rbd_dev_mapping_set(struct rbd_device *rbd_dev)
{ {
const char *snap_name = rbd_dev->spec->snap_name; u64 snap_id = rbd_dev->spec->snap_id;
u64 snap_id;
u64 size = 0; u64 size = 0;
u64 features = 0; u64 features = 0;
int ret; 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); ret = rbd_snap_size(rbd_dev, snap_id, &size);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment