提交 b21ebddd 编写于 作者: A Alex Elder 提交者: Sage Weil

rbd: stop tracking header object version

The rbd code takes care to maintain the version of the header
object.  This was done in hopes of using it to detect a change in
the object between reading it and setting up a watch request to
be notified of changes.

The mechanism was never fully implemented, however.  And we now
avoid the original problem by setting up the watch request before
ever reading the content of the header.

The osd doesn't interpret the object version supplied with a WATCH
osd op, nor does it use the version supplied with a NOTIFY_ACK op
(we can just supply 0 for both).  There is therefore no need to
maintain the header's object version any more, so stop doing so.

We'll be able to simplify some more rbd code in the next few patches
as a result of this.

This resolves:
    http://tracker.ceph.com/issues/3952Signed-off-by: NAlex Elder <elder@inktank.com>
Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
上级 cb75223d
...@@ -110,8 +110,6 @@ struct rbd_image_header { ...@@ -110,8 +110,6 @@ struct rbd_image_header {
u64 stripe_unit; u64 stripe_unit;
u64 stripe_count; u64 stripe_count;
u64 obj_version;
}; };
/* /*
...@@ -2554,8 +2552,7 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start) ...@@ -2554,8 +2552,7 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start)
rbd_dev->watch_request->osd_req); rbd_dev->watch_request->osd_req);
osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_WATCH, osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_WATCH,
rbd_dev->watch_event->cookie, rbd_dev->watch_event->cookie, 0, start);
rbd_dev->header.obj_version, start);
rbd_osd_req_format_write(obj_request); rbd_osd_req_format_write(obj_request);
ret = rbd_obj_request_submit(osdc, obj_request); ret = rbd_obj_request_submit(osdc, obj_request);
...@@ -2987,8 +2984,6 @@ static int rbd_read_header(struct rbd_device *rbd_dev, ...@@ -2987,8 +2984,6 @@ static int rbd_read_header(struct rbd_device *rbd_dev,
if (IS_ERR(ondisk)) if (IS_ERR(ondisk))
return PTR_ERR(ondisk); return PTR_ERR(ondisk);
ret = rbd_header_from_disk(header, ondisk); ret = rbd_header_from_disk(header, ondisk);
if (ret >= 0)
header->obj_version = ver;
kfree(ondisk); kfree(ondisk);
return ret; return ret;
...@@ -3044,9 +3039,6 @@ static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev, u64 *hver) ...@@ -3044,9 +3039,6 @@ static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev, u64 *hver)
/* osd requests may still refer to snapc */ /* osd requests may still refer to snapc */
ceph_put_snap_context(rbd_dev->header.snapc); ceph_put_snap_context(rbd_dev->header.snapc);
if (hver)
*hver = h.obj_version;
rbd_dev->header.obj_version = h.obj_version;
rbd_dev->header.image_size = h.image_size; rbd_dev->header.image_size = h.image_size;
rbd_dev->header.snapc = h.snapc; rbd_dev->header.snapc = h.snapc;
rbd_dev->header.snap_names = h.snap_names; rbd_dev->header.snap_names = h.snap_names;
...@@ -4656,7 +4648,6 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev) ...@@ -4656,7 +4648,6 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev)
ret = rbd_dev_v2_snap_context(rbd_dev, &ver); 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;
dout("discovered version 2 image, header name is %s\n", dout("discovered version 2 image, header name is %s\n",
rbd_dev->header_name); rbd_dev->header_name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册