dm: cleanup dm_any_congested()
authorMike Snitzer <snitzer@redhat.com>
Wed, 3 Feb 2016 03:35:06 +0000 (22:35 -0500)
committerMike Snitzer <snitzer@redhat.com>
Mon, 22 Feb 2016 16:06:20 +0000 (11:06 -0500)
The request-based DM support for checking queue congestion doesn't
require access to the live DM table.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c

index 30302df2020153e719b2b8be6722ad57d4cf648e..d605170a02d9074b69ac141bf96423dc587a8093 100644 (file)
@@ -2137,19 +2137,18 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
        struct dm_table *map;
 
        if (!test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) {
-               map = dm_get_live_table_fast(md);
-               if (map) {
+               if (dm_request_based(md)) {
                        /*
-                        * Request-based dm cares about only own queue for
-                        * the query about congestion status of request_queue
+                        * With request-based DM we only need to check the
+                        * top-level queue for congestion.
                         */
-                       if (dm_request_based(md))
-                               r = md->queue->backing_dev_info.wb.state &
-                                   bdi_bits;
-                       else
+                       r = md->queue->backing_dev_info.wb.state & bdi_bits;
+               } else {
+                       map = dm_get_live_table_fast(md);
+                       if (map)
                                r = dm_table_any_congested(map, bdi_bits);
+                       dm_put_live_table_fast(md);
                }
-               dm_put_live_table_fast(md);
        }
 
        return r;