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.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index eaa3af0e0632..d22b9905c168 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -807,8 +807,6 @@ void dm_requeue_unmapped_request(struct request *clone)
807 dm_unprep_request(rq); 807 dm_unprep_request(rq);
808 808
809 spin_lock_irqsave(q->queue_lock, flags); 809 spin_lock_irqsave(q->queue_lock, flags);
810 if (elv_queue_empty(q))
811 blk_plug_device(q);
812 blk_requeue_request(q, rq); 810 blk_requeue_request(q, rq);
813 spin_unlock_irqrestore(q->queue_lock, flags); 811 spin_unlock_irqrestore(q->queue_lock, flags);
814 812
@@ -1613,10 +1611,10 @@ static void dm_request_fn(struct request_queue *q)
1613 * number of in-flight I/Os after the queue is stopped in 1611 * number of in-flight I/Os after the queue is stopped in
1614 * dm_suspend(). 1612 * dm_suspend().
1615 */ 1613 */
1616 while (!blk_queue_plugged(q) && !blk_queue_stopped(q)) { 1614 while (!blk_queue_stopped(q)) {
1617 rq = blk_peek_request(q); 1615 rq = blk_peek_request(q);
1618 if (!rq) 1616 if (!rq)
1619 goto plug_and_out; 1617 goto delay_and_out;
1620 1618
1621 /* always use block 0 to find the target for flushes for now */ 1619 /* always use block 0 to find the target for flushes for now */
1622 pos = 0; 1620 pos = 0;
@@ -1627,7 +1625,7 @@ static void dm_request_fn(struct request_queue *q)
1627 BUG_ON(!dm_target_is_valid(ti)); 1625 BUG_ON(!dm_target_is_valid(ti));
1628 1626
1629 if (ti->type->busy && ti->type->busy(ti)) 1627 if (ti->type->busy && ti->type->busy(ti))
1630 goto plug_and_out; 1628 goto delay_and_out;
1631 1629
1632 blk_start_request(rq); 1630 blk_start_request(rq);
1633 clone = rq->special; 1631 clone = rq->special;
@@ -1647,11 +1645,8 @@ requeued:
1647 BUG_ON(!irqs_disabled()); 1645 BUG_ON(!irqs_disabled());
1648 spin_lock(q->queue_lock); 1646 spin_lock(q->queue_lock);
1649 1647
1650plug_and_out: 1648delay_and_out:
1651 if (!elv_queue_empty(q)) 1649 blk_delay_queue(q, HZ / 10);
1652 /* Some requests still remain, retry later */
1653 blk_plug_device(q);
1654
1655out: 1650out:
1656 dm_table_put(map); 1651 dm_table_put(map);
1657 1652
@@ -1680,20 +1675,6 @@ static int dm_lld_busy(struct request_queue *q)
1680 return r; 1675 return r;
1681} 1676}
1682 1677
1683static void dm_unplug_all(struct request_queue *q)
1684{
1685 struct mapped_device *md = q->queuedata;
1686 struct dm_table *map = dm_get_live_table(md);
1687
1688 if (map) {
1689 if (dm_request_based(md))
1690 generic_unplug_device(q);
1691
1692 dm_table_unplug_all(map);
1693 dm_table_put(map);
1694 }
1695}
1696
1697static int dm_any_congested(void *congested_data, int bdi_bits) 1678static int dm_any_congested(void *congested_data, int bdi_bits)
1698{ 1679{
1699 int r = bdi_bits; 1680 int r = bdi_bits;
@@ -1817,7 +1798,6 @@ static void dm_init_md_queue(struct mapped_device *md)
1817 md->queue->backing_dev_info.congested_data = md; 1798 md->queue->backing_dev_info.congested_data = md;
1818 blk_queue_make_request(md->queue, dm_request); 1799 blk_queue_make_request(md->queue, dm_request);
1819 blk_queue_bounce_limit(md->queue, BLK_BOUNCE_ANY); 1800 blk_queue_bounce_limit(md->queue, BLK_BOUNCE_ANY);
1820 md->queue->unplug_fn = dm_unplug_all;
1821 blk_queue_merge_bvec(md->queue, dm_merge_bvec); 1801 blk_queue_merge_bvec(md->queue, dm_merge_bvec);
1822 blk_queue_flush(md->queue, REQ_FLUSH | REQ_FUA); 1802 blk_queue_flush(md->queue, REQ_FLUSH | REQ_FUA);
1823} 1803}
@@ -2263,8 +2243,6 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible)
2263 int r = 0; 2243 int r = 0;
2264 DECLARE_WAITQUEUE(wait, current); 2244 DECLARE_WAITQUEUE(wait, current);
2265 2245
2266 dm_unplug_all(md->queue);
2267
2268 add_wait_queue(&md->wait, &wait); 2246 add_wait_queue(&md->wait, &wait);
2269 2247
2270 while (1) { 2248 while (1) {
@@ -2539,7 +2517,6 @@ int dm_resume(struct mapped_device *md)
2539 2517
2540 clear_bit(DMF_SUSPENDED, &md->flags); 2518 clear_bit(DMF_SUSPENDED, &md->flags);
2541 2519
2542 dm_table_unplug_all(map);
2543 r = 0; 2520 r = 0;
2544out: 2521out:
2545 dm_table_put(map); 2522 dm_table_put(map);