aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-delay.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2013-12-31 11:51:02 -0500
committerJens Axboe <axboe@kernel.dk>2013-12-31 11:51:02 -0500
commitb28bc9b38c52f63f43e3fd875af982f2240a2859 (patch)
tree76cdb7b52b58f5685993cc15ed81d1c903023358 /drivers/md/dm-delay.c
parent8d30726912cb39c3a3ebde06214d54861f8fdde2 (diff)
parent802eee95bde72fd0cd0f3a5b2098375a487d1eda (diff)
Merge tag 'v3.13-rc6' into for-3.14/core
Needed to bring blk-mq uptodate, since changes have been going in since for-3.14/core was established. Fixup merge issues related to the immutable biovec changes. Signed-off-by: Jens Axboe <axboe@kernel.dk> Conflicts: block/blk-flush.c fs/btrfs/check-integrity.c fs/btrfs/extent_io.c fs/btrfs/scrub.c fs/logfs/dev_bdev.c
Diffstat (limited to 'drivers/md/dm-delay.c')
-rw-r--r--drivers/md/dm-delay.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index 84c860191a2e..fc8482a65dd2 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -20,6 +20,7 @@
20struct delay_c { 20struct delay_c {
21 struct timer_list delay_timer; 21 struct timer_list delay_timer;
22 struct mutex timer_lock; 22 struct mutex timer_lock;
23 struct workqueue_struct *kdelayd_wq;
23 struct work_struct flush_expired_bios; 24 struct work_struct flush_expired_bios;
24 struct list_head delayed_bios; 25 struct list_head delayed_bios;
25 atomic_t may_delay; 26 atomic_t may_delay;
@@ -45,14 +46,13 @@ struct dm_delay_info {
45 46
46static DEFINE_MUTEX(delayed_bios_lock); 47static DEFINE_MUTEX(delayed_bios_lock);
47 48
48static struct workqueue_struct *kdelayd_wq;
49static struct kmem_cache *delayed_cache; 49static struct kmem_cache *delayed_cache;
50 50
51static void handle_delayed_timer(unsigned long data) 51static void handle_delayed_timer(unsigned long data)
52{ 52{
53 struct delay_c *dc = (struct delay_c *)data; 53 struct delay_c *dc = (struct delay_c *)data;
54 54
55 queue_work(kdelayd_wq, &dc->flush_expired_bios); 55 queue_work(dc->kdelayd_wq, &dc->flush_expired_bios);
56} 56}
57 57
58static void queue_timeout(struct delay_c *dc, unsigned long expires) 58static void queue_timeout(struct delay_c *dc, unsigned long expires)
@@ -191,6 +191,12 @@ out:
191 goto bad_dev_write; 191 goto bad_dev_write;
192 } 192 }
193 193
194 dc->kdelayd_wq = alloc_workqueue("kdelayd", WQ_MEM_RECLAIM, 0);
195 if (!dc->kdelayd_wq) {
196 DMERR("Couldn't start kdelayd");
197 goto bad_queue;
198 }
199
194 setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); 200 setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc);
195 201
196 INIT_WORK(&dc->flush_expired_bios, flush_expired_bios); 202 INIT_WORK(&dc->flush_expired_bios, flush_expired_bios);
@@ -203,6 +209,8 @@ out:
203 ti->private = dc; 209 ti->private = dc;
204 return 0; 210 return 0;
205 211
212bad_queue:
213 mempool_destroy(dc->delayed_pool);
206bad_dev_write: 214bad_dev_write:
207 if (dc->dev_write) 215 if (dc->dev_write)
208 dm_put_device(ti, dc->dev_write); 216 dm_put_device(ti, dc->dev_write);
@@ -217,7 +225,7 @@ static void delay_dtr(struct dm_target *ti)
217{ 225{
218 struct delay_c *dc = ti->private; 226 struct delay_c *dc = ti->private;
219 227
220 flush_workqueue(kdelayd_wq); 228 destroy_workqueue(dc->kdelayd_wq);
221 229
222 dm_put_device(ti, dc->dev_read); 230 dm_put_device(ti, dc->dev_read);
223 231
@@ -351,12 +359,6 @@ static int __init dm_delay_init(void)
351{ 359{
352 int r = -ENOMEM; 360 int r = -ENOMEM;
353 361
354 kdelayd_wq = alloc_workqueue("kdelayd", WQ_MEM_RECLAIM, 0);
355 if (!kdelayd_wq) {
356 DMERR("Couldn't start kdelayd");
357 goto bad_queue;
358 }
359
360 delayed_cache = KMEM_CACHE(dm_delay_info, 0); 362 delayed_cache = KMEM_CACHE(dm_delay_info, 0);
361 if (!delayed_cache) { 363 if (!delayed_cache) {
362 DMERR("Couldn't create delayed bio cache."); 364 DMERR("Couldn't create delayed bio cache.");
@@ -374,8 +376,6 @@ static int __init dm_delay_init(void)
374bad_register: 376bad_register:
375 kmem_cache_destroy(delayed_cache); 377 kmem_cache_destroy(delayed_cache);
376bad_memcache: 378bad_memcache:
377 destroy_workqueue(kdelayd_wq);
378bad_queue:
379 return r; 379 return r;
380} 380}
381 381
@@ -383,7 +383,6 @@ static void __exit dm_delay_exit(void)
383{ 383{
384 dm_unregister_target(&delay_target); 384 dm_unregister_target(&delay_target);
385 kmem_cache_destroy(delayed_cache); 385 kmem_cache_destroy(delayed_cache);
386 destroy_workqueue(kdelayd_wq);
387} 386}
388 387
389/* Module hooks */ 388/* Module hooks */