drbd: Convert timers to use timer_setup()
Subsystems (2)
PATCH 1/1 drbd: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.
Cc Philipp Reisner <[email protected]>
Cc Lars Ellenberg <[email protected]>
Signed-off-by Kees Cook <[email protected]>
---
FYI, this requires -rc3's timer_setup() API. If that's not available, I can carry this in the timers tree with you Ack/Review. Thanks!
--- drivers/block/drbd/drbd_int.h | 4 ++-- drivers/block/drbd/drbd_main.c | 18 +++++++----------- drivers/block/drbd/drbd_receiver.c | 2 +- drivers/block/drbd/drbd_req.c | 4 ++-- drivers/block/drbd/drbd_req.h | 2 +- drivers/block/drbd/drbd_worker.c | 8 ++++---- 6 files changed, 17 insertions(+), 21 deletions(-)
drivers/block/drbd/drbd_int.h +2 -2
@@ -1551,8 +1551,8 @@ extern int w_restart_disk_io(struct drbd_work *, int);extern int w_send_out_of_sync (struct drbd_work *,int );extern int w_start_resync (struct drbd_work *,int ); -extern void resync_timer_fn (unsigned long data); -extern void start_resync_timer_fn (unsigned long data); +extern void resync_timer_fn (struct timer_list *t); +extern void start_resync_timer_fn (struct timer_list *t);extern void drbd_endio_write_sec_final (struct drbd_peer_request *peer_req);
drivers/block/drbd/drbd_main.c +7 -11
@@ -64,7 +64,7 @@static DEFINE_MUTEX (drbd_main_mutex);static int drbd_open (struct block_device *bdev,fmode_t mode);static void drbd_release (struct gendisk *gd,fmode_t mode); -static void md_sync_timer_fn (unsigned long data); +static void md_sync_timer_fn (struct timer_list *t);static int w_bitmap_io (struct drbd_work *w,int unused); MODULE_AUTHOR("Philipp Reisner <[email protected]>, "
@@ -2023,14 +2023,10 @@ void drbd_init_set_defaults(struct drbd_device *device) device->unplug_work.cb = w_send_write_hint; device->bm_io_work.w.cb = w_bitmap_io; -setup_timer (&device->resync_timer, resync_timer_fn, - (unsigned long )device); -setup_timer (&device->md_sync_timer, md_sync_timer_fn, - (unsigned long )device); -setup_timer (&device->start_resync_timer, start_resync_timer_fn, - (unsigned long )device); -setup_timer (&device->request_timer, request_timer_fn, - (unsigned long )device); +timer_setup (&device->resync_timer, resync_timer_fn,0 ); +timer_setup (&device->md_sync_timer, md_sync_timer_fn,0 ); +timer_setup (&device->start_resync_timer, start_resync_timer_fn,0 ); +timer_setup (&device->request_timer, request_timer_fn,0 );init_waitqueue_head (&device->misc_wait);init_waitqueue_head (&device->state_wait);
@@ -3721,9 +3717,9 @@ int drbd_md_test_flag(struct drbd_backing_dev *bdev, int flag)return (bdev->md.flags & flag) !=0 ; } -static void md_sync_timer_fn (unsigned long data) +static void md_sync_timer_fn (struct timer_list *t) { -struct drbd_device *device = (struct drbd_device *) data; +struct drbd_device *device =from_timer (device, t, md_sync_timer);drbd_device_post_work (device,MD_SYNC ); }
drivers/block/drbd/drbd_receiver.c +1 -1
@@ -5056,7 +5056,7 @@ static int drbd_disconnected(struct drbd_peer_device *peer_device)wake_up (&device->misc_wait);del_timer_sync (&device->resync_timer); -resync_timer_fn ((unsigned long )device); +resync_timer_fn (&device->resync_timer);/* wait for all w_e_end_data_req, w_e_end_rsdata_req, w_send_barrier, * w_make_resync_request etc. which may still be on the worker queue
drivers/block/drbd/drbd_req.c +2 -2
@@ -1714,9 +1714,9 @@ static bool net_timeout_reached(struct drbd_request *net_req,* to expire twice (worst case) to become effective. Good enough. */ -void request_timer_fn (unsigned long data) +void request_timer_fn (struct timer_list *t) { -struct drbd_device *device = (struct drbd_device *) data; +struct drbd_device *device =from_timer (device, t, request_timer);struct drbd_connection *connection =first_peer_device (device)->connection;struct drbd_request *req_read, *req_write, *req_peer;/* oldest request */ struct net_conf *nc;
drivers/block/drbd/drbd_req.h +1 -1
@@ -294,7 +294,7 @@ extern int __req_mod(struct drbd_request *req, enum drbd_req_event what, struct bio_and_error *m);extern void complete_master_bio (struct drbd_device *device,struct bio_and_error *m); -extern void request_timer_fn (unsigned long data); +extern void request_timer_fn (struct timer_list *t);extern void tl_restart (struct drbd_connection *connection,enum drbd_req_event what);extern void _tl_restart (struct drbd_connection *connection,enum drbd_req_event what);extern void tl_abort_disk_io (struct drbd_device *device);
drivers/block/drbd/drbd_worker.c +4 -4
@@ -457,9 +457,9 @@ int w_resync_timer(struct drbd_work *w, int cancel)return 0 ; } -void resync_timer_fn (unsigned long data) +void resync_timer_fn (struct timer_list *t) { -struct drbd_device *device = (struct drbd_device *) data; +struct drbd_device *device =from_timer (device, t, resync_timer); drbd_queue_work_if_unqueued( &first_peer_device(device)->connection->sender_work,
@@ -1705,9 +1705,9 @@ void drbd_rs_controller_reset(struct drbd_device *device)rcu_read_unlock (); } -void start_resync_timer_fn (unsigned long data) +void start_resync_timer_fn (struct timer_list *t) { -struct drbd_device *device = (struct drbd_device *) data; +struct drbd_device *device =from_timer (device, t, start_resync_timer);drbd_device_post_work (device,RS_START ); }
Signature · 6 lines
2.7.4 -- Kees Cook Pixel Security