Commit fa58bcad authored by Ilya Dryomov's avatar Ilya Dryomov

rbd: don't query snapshot features

Since infernalis, ceph.git commit 281f87f9ee52 ("cls_rbd: get_features
on snapshots returns HEAD image features"), querying and checking that
is pointless.  Userspace support for manipulating image features after
image creation came also in infernalis, so a snapshot with a different
set of features wasn't ever possible.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Reviewed-by: default avatarJason Dillaman <dillaman@redhat.com>
Reviewed-by: default avatarDongsheng Yang <dongsheng.yang@easystack.cn>
parent 686238b7
...@@ -377,7 +377,6 @@ struct rbd_client_id { ...@@ -377,7 +377,6 @@ struct rbd_client_id {
struct rbd_mapping { struct rbd_mapping {
u64 size; u64 size;
u64 features;
}; };
/* /*
...@@ -644,8 +643,6 @@ static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev, ...@@ -644,8 +643,6 @@ static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev,
u64 snap_id); u64 snap_id);
static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id,
u8 *order, u64 *snap_size); u8 *order, u64 *snap_size);
static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
u64 *snap_features);
static int rbd_dev_v2_get_flags(struct rbd_device *rbd_dev); static int rbd_dev_v2_get_flags(struct rbd_device *rbd_dev);
static void rbd_obj_handle_request(struct rbd_obj_request *obj_req, int result); static void rbd_obj_handle_request(struct rbd_obj_request *obj_req, int result);
...@@ -1320,51 +1317,23 @@ static int rbd_snap_size(struct rbd_device *rbd_dev, u64 snap_id, ...@@ -1320,51 +1317,23 @@ static int rbd_snap_size(struct rbd_device *rbd_dev, u64 snap_id,
return 0; return 0;
} }
static int rbd_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
u64 *snap_features)
{
rbd_assert(rbd_image_format_valid(rbd_dev->image_format));
if (snap_id == CEPH_NOSNAP) {
*snap_features = rbd_dev->header.features;
} else if (rbd_dev->image_format == 1) {
*snap_features = 0; /* No features for format 1 */
} else {
u64 features = 0;
int ret;
ret = _rbd_dev_v2_snap_features(rbd_dev, snap_id, &features);
if (ret)
return ret;
*snap_features = features;
}
return 0;
}
static int rbd_dev_mapping_set(struct rbd_device *rbd_dev) static int rbd_dev_mapping_set(struct rbd_device *rbd_dev)
{ {
u64 snap_id = rbd_dev->spec->snap_id; u64 snap_id = rbd_dev->spec->snap_id;
u64 size = 0; u64 size = 0;
u64 features = 0;
int ret; int ret;
ret = rbd_snap_size(rbd_dev, snap_id, &size); ret = rbd_snap_size(rbd_dev, snap_id, &size);
if (ret)
return ret;
ret = rbd_snap_features(rbd_dev, snap_id, &features);
if (ret) if (ret)
return ret; return ret;
rbd_dev->mapping.size = size; rbd_dev->mapping.size = size;
rbd_dev->mapping.features = features;
return 0; return 0;
} }
static void rbd_dev_mapping_clear(struct rbd_device *rbd_dev) static void rbd_dev_mapping_clear(struct rbd_device *rbd_dev)
{ {
rbd_dev->mapping.size = 0; rbd_dev->mapping.size = 0;
rbd_dev->mapping.features = 0;
} }
static void zero_bvec(struct bio_vec *bv) static void zero_bvec(struct bio_vec *bv)
...@@ -5207,17 +5176,12 @@ static ssize_t rbd_size_show(struct device *dev, ...@@ -5207,17 +5176,12 @@ static ssize_t rbd_size_show(struct device *dev,
(unsigned long long)rbd_dev->mapping.size); (unsigned long long)rbd_dev->mapping.size);
} }
/*
* Note this shows the features for whatever's mapped, which is not
* necessarily the base image.
*/
static ssize_t rbd_features_show(struct device *dev, static ssize_t rbd_features_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
return sprintf(buf, "0x%016llx\n", return sprintf(buf, "0x%016llx\n", rbd_dev->header.features);
(unsigned long long)rbd_dev->mapping.features);
} }
static ssize_t rbd_major_show(struct device *dev, static ssize_t rbd_major_show(struct device *dev,
......
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