Commit 6e14b1a6 authored by Alex Elder's avatar Alex Elder

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: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent b8b1e2db
...@@ -2241,7 +2241,7 @@ static int rbd_dev_v2_features(struct rbd_device *rbd_dev) ...@@ -2241,7 +2241,7 @@ static int rbd_dev_v2_features(struct rbd_device *rbd_dev)
&rbd_dev->header.features); &rbd_dev->header.features);
} }
static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev) static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev, u64 *ver)
{ {
size_t size; size_t size;
int ret; int ret;
...@@ -2269,7 +2269,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev) ...@@ -2269,7 +2269,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev)
"rbd", "get_snapcontext", "rbd", "get_snapcontext",
NULL, 0, NULL, 0,
reply_buf, size, reply_buf, size,
CEPH_OSD_FLAG_READ, NULL); CEPH_OSD_FLAG_READ, ver);
dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret); dout("%s: rbd_req_sync_exec returned %d\n", __func__, ret);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -2906,6 +2906,7 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev) ...@@ -2906,6 +2906,7 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev)
{ {
size_t size; size_t size;
int ret; int ret;
u64 ver = 0;
/* /*
* Image id was filled in by the caller. Record the header * 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,11 +2937,18 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev)
if (ret < 0) if (ret < 0)
goto out_err; goto out_err;
/* Get the snapshot context */ /* crypto and compression type aren't (yet) supported for v2 images */
rbd_dev->header.crypt_type = 0;
rbd_dev->header.comp_type = 0;
ret = rbd_dev_v2_snap_context(rbd_dev); /* Get the snapshot context, plus the header version */
ret = rbd_dev_v2_snap_context(rbd_dev, &ver);
if (ret) if (ret)
goto out_err; goto out_err;
rbd_dev->header.obj_version = ver;
rbd_dev->image_format = 2; rbd_dev->image_format = 2;
dout("discovered version 2 image, header name is %s\n", dout("discovered version 2 image, header name is %s\n",
......
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