diff options
author | Alex Elder <elder@inktank.com> | 2013-02-15 12:42:30 -0500 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2013-02-18 13:20:00 -0500 |
commit | 3c663bbdcdf9296e0fe3362acb9e81f49d7b72c6 (patch) | |
tree | 6fe7358d5dfce2d39cde3f0b35a78808ab1b674d | |
parent | 60e56f138180e72fa8487d4b9c1c916013494f46 (diff) |
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: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r-- | drivers/block/rbd.c | 2 | ||||
-rw-r--r-- | include/linux/ceph/osd_client.h | 3 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 11 |
3 files changed, 7 insertions, 9 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 982963ec2607..13ee789f2328 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1744,7 +1744,7 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start) | |||
1744 | rbd_assert(start ^ !!rbd_dev->watch_request); | 1744 | rbd_assert(start ^ !!rbd_dev->watch_request); |
1745 | 1745 | ||
1746 | if (start) { | 1746 | if (start) { |
1747 | ret = ceph_osdc_create_event(osdc, rbd_watch_cb, 0, rbd_dev, | 1747 | ret = ceph_osdc_create_event(osdc, rbd_watch_cb, rbd_dev, |
1748 | &rbd_dev->watch_event); | 1748 | &rbd_dev->watch_event); |
1749 | if (ret < 0) | 1749 | if (ret < 0) |
1750 | return ret; | 1750 | return ret; |
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index c39e7ed4b203..39c55d61e159 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
@@ -273,8 +273,7 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, | |||
273 | /* watch/notify events */ | 273 | /* watch/notify events */ |
274 | extern int ceph_osdc_create_event(struct ceph_osd_client *osdc, | 274 | extern int ceph_osdc_create_event(struct ceph_osd_client *osdc, |
275 | void (*event_cb)(u64, u64, u8, void *), | 275 | void (*event_cb)(u64, u64, u8, void *), |
276 | int one_shot, void *data, | 276 | void *data, struct ceph_osd_event **pevent); |
277 | struct ceph_osd_event **pevent); | ||
278 | extern void ceph_osdc_cancel_event(struct ceph_osd_event *event); | 277 | extern void ceph_osdc_cancel_event(struct ceph_osd_event *event); |
279 | extern int ceph_osdc_wait_event(struct ceph_osd_event *event, | 278 | extern int ceph_osdc_wait_event(struct ceph_osd_event *event, |
280 | unsigned long timeout); | 279 | unsigned long timeout); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index cd3a489b7438..4322faa7c811 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1477,8 +1477,7 @@ static void __remove_event(struct ceph_osd_event *event) | |||
1477 | 1477 | ||
1478 | int ceph_osdc_create_event(struct ceph_osd_client *osdc, | 1478 | int ceph_osdc_create_event(struct ceph_osd_client *osdc, |
1479 | void (*event_cb)(u64, u64, u8, void *), | 1479 | void (*event_cb)(u64, u64, u8, void *), |
1480 | int one_shot, void *data, | 1480 | void *data, struct ceph_osd_event **pevent) |
1481 | struct ceph_osd_event **pevent) | ||
1482 | { | 1481 | { |
1483 | struct ceph_osd_event *event; | 1482 | struct ceph_osd_event *event; |
1484 | 1483 | ||
@@ -1488,7 +1487,7 @@ int ceph_osdc_create_event(struct ceph_osd_client *osdc, | |||
1488 | 1487 | ||
1489 | dout("create_event %p\n", event); | 1488 | dout("create_event %p\n", event); |
1490 | event->cb = event_cb; | 1489 | event->cb = event_cb; |
1491 | event->one_shot = one_shot; | 1490 | event->one_shot = 0; |
1492 | event->data = data; | 1491 | event->data = data; |
1493 | event->osdc = osdc; | 1492 | event->osdc = osdc; |
1494 | INIT_LIST_HEAD(&event->osd_node); | 1493 | INIT_LIST_HEAD(&event->osd_node); |
@@ -1541,7 +1540,8 @@ static void do_event_work(struct work_struct *work) | |||
1541 | /* | 1540 | /* |
1542 | * Process osd watch notifications | 1541 | * Process osd watch notifications |
1543 | */ | 1542 | */ |
1544 | void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg) | 1543 | static void handle_watch_notify(struct ceph_osd_client *osdc, |
1544 | struct ceph_msg *msg) | ||
1545 | { | 1545 | { |
1546 | void *p, *end; | 1546 | void *p, *end; |
1547 | u8 proto_ver; | 1547 | u8 proto_ver; |
@@ -1562,9 +1562,8 @@ void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg) | |||
1562 | spin_lock(&osdc->event_lock); | 1562 | spin_lock(&osdc->event_lock); |
1563 | event = __find_event(osdc, cookie); | 1563 | event = __find_event(osdc, cookie); |
1564 | if (event) { | 1564 | if (event) { |
1565 | BUG_ON(event->one_shot); | ||
1565 | get_event(event); | 1566 | get_event(event); |
1566 | if (event->one_shot) | ||
1567 | __remove_event(event); | ||
1568 | } | 1567 | } |
1569 | spin_unlock(&osdc->event_lock); | 1568 | spin_unlock(&osdc->event_lock); |
1570 | dout("handle_watch_notify cookie %lld ver %lld event %p\n", | 1569 | dout("handle_watch_notify cookie %lld ver %lld event %p\n", |