提交 3c663bbd 编写于 作者: A Alex Elder

libceph: kill ceph_osdc_create_event() "one_shot" parameter

There is only one caller of ceph_osdc_create_event(), and it
provides 0 as its "one_shot" argument.  Get rid of that argument and
just use 0 in its place.

Replace the code in handle_watch_notify() that executes if one_shot
is nonzero in the event with a BUG_ON() call.

While modifying "osd_client.c", give handle_watch_notify() static
scope.
Signed-off-by: NAlex Elder <elder@inktank.com>
Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
上级 60e56f13
...@@ -1744,7 +1744,7 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start) ...@@ -1744,7 +1744,7 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start)
rbd_assert(start ^ !!rbd_dev->watch_request); rbd_assert(start ^ !!rbd_dev->watch_request);
if (start) { if (start) {
ret = ceph_osdc_create_event(osdc, rbd_watch_cb, 0, rbd_dev, ret = ceph_osdc_create_event(osdc, rbd_watch_cb, rbd_dev,
&rbd_dev->watch_event); &rbd_dev->watch_event);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -273,8 +273,7 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, ...@@ -273,8 +273,7 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
/* watch/notify events */ /* watch/notify events */
extern int ceph_osdc_create_event(struct ceph_osd_client *osdc, extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
void (*event_cb)(u64, u64, u8, void *), void (*event_cb)(u64, u64, u8, void *),
int one_shot, void *data, void *data, struct ceph_osd_event **pevent);
struct ceph_osd_event **pevent);
extern void ceph_osdc_cancel_event(struct ceph_osd_event *event); extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
extern int ceph_osdc_wait_event(struct ceph_osd_event *event, extern int ceph_osdc_wait_event(struct ceph_osd_event *event,
unsigned long timeout); unsigned long timeout);
......
...@@ -1477,8 +1477,7 @@ static void __remove_event(struct ceph_osd_event *event) ...@@ -1477,8 +1477,7 @@ static void __remove_event(struct ceph_osd_event *event)
int ceph_osdc_create_event(struct ceph_osd_client *osdc, int ceph_osdc_create_event(struct ceph_osd_client *osdc,
void (*event_cb)(u64, u64, u8, void *), void (*event_cb)(u64, u64, u8, void *),
int one_shot, void *data, void *data, struct ceph_osd_event **pevent)
struct ceph_osd_event **pevent)
{ {
struct ceph_osd_event *event; struct ceph_osd_event *event;
...@@ -1488,7 +1487,7 @@ int ceph_osdc_create_event(struct ceph_osd_client *osdc, ...@@ -1488,7 +1487,7 @@ int ceph_osdc_create_event(struct ceph_osd_client *osdc,
dout("create_event %p\n", event); dout("create_event %p\n", event);
event->cb = event_cb; event->cb = event_cb;
event->one_shot = one_shot; event->one_shot = 0;
event->data = data; event->data = data;
event->osdc = osdc; event->osdc = osdc;
INIT_LIST_HEAD(&event->osd_node); INIT_LIST_HEAD(&event->osd_node);
...@@ -1541,7 +1540,8 @@ static void do_event_work(struct work_struct *work) ...@@ -1541,7 +1540,8 @@ static void do_event_work(struct work_struct *work)
/* /*
* Process osd watch notifications * Process osd watch notifications
*/ */
void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg) static void handle_watch_notify(struct ceph_osd_client *osdc,
struct ceph_msg *msg)
{ {
void *p, *end; void *p, *end;
u8 proto_ver; u8 proto_ver;
...@@ -1562,9 +1562,8 @@ void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg) ...@@ -1562,9 +1562,8 @@ void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg)
spin_lock(&osdc->event_lock); spin_lock(&osdc->event_lock);
event = __find_event(osdc, cookie); event = __find_event(osdc, cookie);
if (event) { if (event) {
BUG_ON(event->one_shot);
get_event(event); get_event(event);
if (event->one_shot)
__remove_event(event);
} }
spin_unlock(&osdc->event_lock); spin_unlock(&osdc->event_lock);
dout("handle_watch_notify cookie %lld ver %lld event %p\n", dout("handle_watch_notify cookie %lld ver %lld event %p\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册