aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 473f0c3c0192..73b89afd6565 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -452,6 +452,12 @@ static void free_bio_info(struct dm_rq_clone_bio_info *info)
452 mempool_free(info, info->tio->md->io_pool); 452 mempool_free(info, info->tio->md->io_pool);
453} 453}
454 454
455static int md_in_flight(struct mapped_device *md)
456{
457 return atomic_read(&md->pending[READ]) +
458 atomic_read(&md->pending[WRITE]);
459}
460
455static void start_io_acct(struct dm_io *io) 461static void start_io_acct(struct dm_io *io)
456{ 462{
457 struct mapped_device *md = io->md; 463 struct mapped_device *md = io->md;
@@ -2100,8 +2106,7 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible)
2100 break; 2106 break;
2101 } 2107 }
2102 spin_unlock_irqrestore(q->queue_lock, flags); 2108 spin_unlock_irqrestore(q->queue_lock, flags);
2103 } else if (!atomic_read(&md->pending[0]) && 2109 } else if (!md_in_flight(md))
2104 !atomic_read(&md->pending[1]))
2105 break; 2110 break;
2106 2111
2107 if (interruptible == TASK_INTERRUPTIBLE && 2112 if (interruptible == TASK_INTERRUPTIBLE &&