aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-05-06 08:40:30 -0400
committerAlex Elder <elder@inktank.com>2013-05-08 08:48:11 -0400
commit8f4b7d9821715767ac28bbc2d401bbb5f3f9a448 (patch)
tree9486cd94a485ae65f9d30e2ea530033f618c48b8 /drivers/block/rbd.c
parentc734b79655a91a24afcae73738a43a0db09a801a (diff)
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: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 2d34aea772be..75a8cea1a2d0 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,
936 936
937static int rbd_dev_mapping_set(struct rbd_device *rbd_dev) 937static int rbd_dev_mapping_set(struct rbd_device *rbd_dev)
938{ 938{
939 const char *snap_name = rbd_dev->spec->snap_name; 939 u64 snap_id = rbd_dev->spec->snap_id;
940 u64 snap_id;
941 u64 size = 0; 940 u64 size = 0;
942 u64 features = 0; 941 u64 features = 0;
943 int ret; 942 int ret;
944 943
945 if (strcmp(snap_name, RBD_SNAP_HEAD_NAME)) {
946 snap_id = rbd_snap_id_by_name(rbd_dev, snap_name);
947 if (snap_id == CEPH_NOSNAP)
948 return -ENOENT;
949 } else {
950 snap_id = CEPH_NOSNAP;
951 }
952
953 ret = rbd_snap_size(rbd_dev, snap_id, &size); 944 ret = rbd_snap_size(rbd_dev, snap_id, &size);
954 if (ret) 945 if (ret)
955 return ret; 946 return ret;