diff options
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 6963ad148408..c99e4728ff41 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -375,7 +375,7 @@ static void start_io_acct(struct dm_io *io) | |||
375 | dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending); | 375 | dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending); |
376 | } | 376 | } |
377 | 377 | ||
378 | static int end_io_acct(struct dm_io *io) | 378 | static void end_io_acct(struct dm_io *io) |
379 | { | 379 | { |
380 | struct mapped_device *md = io->md; | 380 | struct mapped_device *md = io->md; |
381 | struct bio *bio = io->bio; | 381 | struct bio *bio = io->bio; |
@@ -391,7 +391,9 @@ static int end_io_acct(struct dm_io *io) | |||
391 | dm_disk(md)->part0.in_flight = pending = | 391 | dm_disk(md)->part0.in_flight = pending = |
392 | atomic_dec_return(&md->pending); | 392 | atomic_dec_return(&md->pending); |
393 | 393 | ||
394 | return !pending; | 394 | /* nudge anyone waiting on suspend queue */ |
395 | if (!pending) | ||
396 | wake_up(&md->wait); | ||
395 | } | 397 | } |
396 | 398 | ||
397 | /* | 399 | /* |
@@ -499,9 +501,7 @@ static void dec_pending(struct dm_io *io, int error) | |||
499 | spin_unlock_irqrestore(&io->md->pushback_lock, flags); | 501 | spin_unlock_irqrestore(&io->md->pushback_lock, flags); |
500 | } | 502 | } |
501 | 503 | ||
502 | if (end_io_acct(io)) | 504 | end_io_acct(io); |
503 | /* nudge anyone waiting on suspend queue */ | ||
504 | wake_up(&io->md->wait); | ||
505 | 505 | ||
506 | if (io->error != DM_ENDIO_REQUEUE) { | 506 | if (io->error != DM_ENDIO_REQUEUE) { |
507 | blk_add_trace_bio(io->md->queue, io->bio, | 507 | blk_add_trace_bio(io->md->queue, io->bio, |
@@ -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 | ||