aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-07-03 17:01:19 -0400
committerAlex Elder <elder@inktank.com>2012-10-01 15:30:54 -0400
commit6e14b1a6c3b8d7e48ece68733d2dac0464611ee4 (patch)
treeff1c6851a6de987cf932a90277e830f00867964f /drivers/block
parentb8b1e2db52de61f575981d0c23da785a7c5b4a77 (diff)
rbd: update remaining header fields for v2
There are three fields that are not yet updated for format 2 rbd image headers: the version of the header object; the encryption type; and the compression type. There is no interface defined for fetching the latter two, so just initialize them explicitly to 0 for now. Change rbd_dev_v2_snap_context() so the caller can be supplied the version for the header object. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b51f1c997c1d..2f1bef8c1d88 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2241,7 +2241,7 @@ static int rbd_dev_v2_features(struct rbd_device *rbd_dev)
2241 &rbd_dev->header.features); 2241 &rbd_dev->header.features);
2242} 2242}
2243 2243
2244static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev) 2244static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev, u64 *ver)
2245{ 2245{
2246 size_t size; 2246 size_t size;
2247 int ret; 2247 int ret;
@@ -2269,7 +2269,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev)
2269 "rbd", "get_snapcontext", 2269 "rbd", "get_snapcontext",
2270 NULL, 0, 2270 NULL, 0,
2271 reply_buf, size, 2271 reply_buf, size,
2272 CEPH_OSD_FLAG_READ, NULL); 2272 CEPH_OSD_FLAG_READ, ver);
2273 dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret); 2273 dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
2274 if (ret < 0) 2274 if (ret < 0)
2275 goto out; 2275 goto out;
@@ -2906,6 +2906,7 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev)
2906{ 2906{
2907 size_t size; 2907 size_t size;
2908 int ret; 2908 int ret;
2909 u64 ver = 0;
2909 2910
2910 /* 2911 /*
2911 * Image id was filled in by the caller. Record the header 2912 * Image id was filled in by the caller. Record the header
@@ -2936,11 +2937,18 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev)
2936 if (ret < 0) 2937 if (ret < 0)
2937 goto out_err; 2938 goto out_err;
2938 2939
2939 /* Get the snapshot context */ 2940 /* crypto and compression type aren't (yet) supported for v2 images */
2941
2942 rbd_dev->header.crypt_type = 0;
2943 rbd_dev->header.comp_type = 0;
2940 2944
2941 ret = rbd_dev_v2_snap_context(rbd_dev); 2945 /* Get the snapshot context, plus the header version */
2946
2947 ret = rbd_dev_v2_snap_context(rbd_dev, &ver);
2942 if (ret) 2948 if (ret)
2943 goto out_err; 2949 goto out_err;
2950 rbd_dev->header.obj_version = ver;
2951
2944 rbd_dev->image_format = 2; 2952 rbd_dev->image_format = 2;
2945 2953
2946 dout("discovered version 2 image, header name is %s\n", 2954 dout("discovered version 2 image, header name is %s\n",