diff options
author | Mike Snitzer <snitzer@redhat.com> | 2014-03-20 08:36:47 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-03-31 10:05:51 -0400 |
commit | 760fe67e539b2f1a95dbb4c9700140eccdb1c0c1 (patch) | |
tree | 985b145d41a1a6fac2ec5fae981377c6d69bc154 /drivers/md | |
parent | fe76cd88e654124d1431bb662a0fc6e99ca811a5 (diff) |
dm thin: simplify pool_is_congested
The pool is congested if the pool is in PM_OUT_OF_DATA_SPACE mode. This
is more explicit/clear/efficient than inferring whether or not the pool
is congested by checking if retry_on_resume_list is empty.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-thin.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 60cc50685c1..af871fd48eb 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -1757,20 +1757,14 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) static int pool_is_congested(struct dm_target_callbacks *cb, int bdi_bits) { - int r; - unsigned long flags; struct pool_c *pt = container_of(cb, struct pool_c, callbacks); + struct request_queue *q; - spin_lock_irqsave(&pt->pool->lock, flags); - r = !bio_list_empty(&pt->pool->retry_on_resume_list); - spin_unlock_irqrestore(&pt->pool->lock, flags); + if (get_pool_mode(pt->pool) == PM_OUT_OF_DATA_SPACE) + return 1; - if (!r) { - struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); - r = bdi_congested(&q->backing_dev_info, bdi_bits); - } - - return r; + q = bdev_get_queue(pt->data_dev->bdev); + return bdi_congested(&q->backing_dev_info, bdi_bits); } static void __requeue_bios(struct pool *pool) |