aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 376f1ab48a24..23e76fe0d359 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -130,7 +130,7 @@ struct mapped_device {
130 /* 130 /*
131 * A list of ios that arrived while we were suspended. 131 * A list of ios that arrived while we were suspended.
132 */ 132 */
133 atomic_t pending[2]; 133 atomic_t pending;
134 wait_queue_head_t wait; 134 wait_queue_head_t wait;
135 struct work_struct work; 135 struct work_struct work;
136 struct bio_list deferred; 136 struct bio_list deferred;
@@ -453,14 +453,13 @@ static void start_io_acct(struct dm_io *io)
453{ 453{
454 struct mapped_device *md = io->md; 454 struct mapped_device *md = io->md;
455 int cpu; 455 int cpu;
456 int rw = bio_data_dir(io->bio);
457 456
458 io->start_time = jiffies; 457 io->start_time = jiffies;
459 458
460 cpu = part_stat_lock(); 459 cpu = part_stat_lock();
461 part_round_stats(cpu, &dm_disk(md)->part0); 460 part_round_stats(cpu, &dm_disk(md)->part0);
462 part_stat_unlock(); 461 part_stat_unlock();
463 dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]); 462 dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending);
464} 463}
465 464
466static void end_io_acct(struct dm_io *io) 465static void end_io_acct(struct dm_io *io)
@@ -480,9 +479,8 @@ static void end_io_acct(struct dm_io *io)
480 * After this is decremented the bio must not be touched if it is 479 * After this is decremented the bio must not be touched if it is
481 * a barrier. 480 * a barrier.
482 */ 481 */
483 dm_disk(md)->part0.in_flight[rw] = pending = 482 dm_disk(md)->part0.in_flight = pending =
484 atomic_dec_return(&md->pending[rw]); 483 atomic_dec_return(&md->pending);
485 pending += atomic_read(&md->pending[rw^0x1]);
486 484
487 /* nudge anyone waiting on suspend queue */ 485 /* nudge anyone waiting on suspend queue */
488 if (!pending) 486 if (!pending)
@@ -1787,8 +1785,7 @@ static struct mapped_device *alloc_dev(int minor)
1787 if (!md->disk) 1785 if (!md->disk)
1788 goto bad_disk; 1786 goto bad_disk;
1789 1787
1790 atomic_set(&md->pending[0], 0); 1788 atomic_set(&md->pending, 0);
1791 atomic_set(&md->pending[1], 0);
1792 init_waitqueue_head(&md->wait); 1789 init_waitqueue_head(&md->wait);
1793 INIT_WORK(&md->work, dm_wq_work); 1790 INIT_WORK(&md->work, dm_wq_work);
1794 init_waitqueue_head(&md->eventq); 1791 init_waitqueue_head(&md->eventq);
@@ -2091,8 +2088,7 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible)
2091 break; 2088 break;
2092 } 2089 }
2093 spin_unlock_irqrestore(q->queue_lock, flags); 2090 spin_unlock_irqrestore(q->queue_lock, flags);
2094 } else if (!atomic_read(&md->pending[0]) && 2091 } else if (!atomic_read(&md->pending))
2095 !atomic_read(&md->pending[1]))
2096 break; 2092 break;
2097 2093
2098 if (interruptible == TASK_INTERRUPTIBLE && 2094 if (interruptible == TASK_INTERRUPTIBLE &&