diff options
-rw-r--r-- | drivers/md/dm.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index dc25d8a07bc7..c99e4728ff41 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -937,16 +937,24 @@ static void dm_unplug_all(struct request_queue *q) | |||
937 | 937 | ||
938 | static int dm_any_congested(void *congested_data, int bdi_bits) | 938 | static int dm_any_congested(void *congested_data, int bdi_bits) |
939 | { | 939 | { |
940 | int r; | 940 | int r = bdi_bits; |
941 | struct mapped_device *md = (struct mapped_device *) congested_data; | 941 | struct mapped_device *md = congested_data; |
942 | struct dm_table *map = dm_get_table(md); | 942 | struct dm_table *map; |
943 | 943 | ||
944 | if (!map || test_bit(DMF_BLOCK_IO, &md->flags)) | 944 | atomic_inc(&md->pending); |
945 | r = bdi_bits; | 945 | |
946 | else | 946 | if (!test_bit(DMF_BLOCK_IO, &md->flags)) { |
947 | r = dm_table_any_congested(map, bdi_bits); | 947 | map = dm_get_table(md); |
948 | if (map) { | ||
949 | r = dm_table_any_congested(map, bdi_bits); | ||
950 | dm_table_put(map); | ||
951 | } | ||
952 | } | ||
953 | |||
954 | if (!atomic_dec_return(&md->pending)) | ||
955 | /* nudge anyone waiting on suspend queue */ | ||
956 | wake_up(&md->wait); | ||
948 | 957 | ||
949 | dm_table_put(map); | ||
950 | return r; | 958 | return r; |
951 | } | 959 | } |
952 | 960 | ||