Commit 760fe67e539b2f1a95dbb4c9700140eccdb1c0c1
1 parent
fe76cd88e6
Exists in
master
and in
13 other branches
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>
Showing 1 changed file with 5 additions and 11 deletions Side-by-side Diff
drivers/md/dm-thin.c
... | ... | @@ -1757,20 +1757,14 @@ |
1757 | 1757 | |
1758 | 1758 | static int pool_is_congested(struct dm_target_callbacks *cb, int bdi_bits) |
1759 | 1759 | { |
1760 | - int r; | |
1761 | - unsigned long flags; | |
1762 | 1760 | struct pool_c *pt = container_of(cb, struct pool_c, callbacks); |
1761 | + struct request_queue *q; | |
1763 | 1762 | |
1764 | - spin_lock_irqsave(&pt->pool->lock, flags); | |
1765 | - r = !bio_list_empty(&pt->pool->retry_on_resume_list); | |
1766 | - spin_unlock_irqrestore(&pt->pool->lock, flags); | |
1763 | + if (get_pool_mode(pt->pool) == PM_OUT_OF_DATA_SPACE) | |
1764 | + return 1; | |
1767 | 1765 | |
1768 | - if (!r) { | |
1769 | - struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); | |
1770 | - r = bdi_congested(&q->backing_dev_info, bdi_bits); | |
1771 | - } | |
1772 | - | |
1773 | - return r; | |
1766 | + q = bdev_get_queue(pt->data_dev->bdev); | |
1767 | + return bdi_congested(&q->backing_dev_info, bdi_bits); | |
1774 | 1768 | } |
1775 | 1769 | |
1776 | 1770 | static void __requeue_bios(struct pool *pool) |