diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-04-08 19:27:15 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-04-08 19:27:15 -0400 |
commit | 92c639021ca6e962645114f02e356e7feb131d0b (patch) | |
tree | eee01e9394b09fb3929fd4f3682815e91b87c764 /drivers/md/dm.c | |
parent | 3b00b2036fac7a7667d0676a0f80eee575b8c32b (diff) |
dm: remove dm_request loop
Remove queue_io return value and a loop in dm_request.
IO may be submitted to a worker thread with queue_io(). queue_io() sets
DMF_QUEUE_IO_TO_THREAD so that all further IO is queued for the thread. When
the thread finishes its work, it clears DMF_QUEUE_IO_TO_THREAD and from this
point on, requests are submitted from dm_request again. This will be used
for processing barriers.
Remove the loop in dm_request. queue_io() can submit I/Os to the worker thread
even if DMF_QUEUE_IO_TO_THREAD was not set.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 9746c1eb9ef7..db022e5f3912 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -436,21 +436,18 @@ static void end_io_acct(struct dm_io *io) | |||
436 | /* | 436 | /* |
437 | * Add the bio to the list of deferred io. | 437 | * Add the bio to the list of deferred io. |
438 | */ | 438 | */ |
439 | static int queue_io(struct mapped_device *md, struct bio *bio) | 439 | static void queue_io(struct mapped_device *md, struct bio *bio) |
440 | { | 440 | { |
441 | down_write(&md->io_lock); | 441 | down_write(&md->io_lock); |
442 | 442 | ||
443 | if (!test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) { | ||
444 | up_write(&md->io_lock); | ||
445 | return 1; | ||
446 | } | ||
447 | |||
448 | spin_lock_irq(&md->deferred_lock); | 443 | spin_lock_irq(&md->deferred_lock); |
449 | bio_list_add(&md->deferred, bio); | 444 | bio_list_add(&md->deferred, bio); |
450 | spin_unlock_irq(&md->deferred_lock); | 445 | spin_unlock_irq(&md->deferred_lock); |
451 | 446 | ||
447 | if (!test_and_set_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) | ||
448 | queue_work(md->wq, &md->work); | ||
449 | |||
452 | up_write(&md->io_lock); | 450 | up_write(&md->io_lock); |
453 | return 0; /* deferred successfully */ | ||
454 | } | 451 | } |
455 | 452 | ||
456 | /* | 453 | /* |
@@ -953,7 +950,7 @@ static int dm_request(struct request_queue *q, struct bio *bio) | |||
953 | * If we're suspended or the thread is processing barriers | 950 | * If we're suspended or the thread is processing barriers |
954 | * we have to queue this io for later. | 951 | * we have to queue this io for later. |
955 | */ | 952 | */ |
956 | while (test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) { | 953 | if (unlikely(test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags))) { |
957 | up_read(&md->io_lock); | 954 | up_read(&md->io_lock); |
958 | 955 | ||
959 | if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) && | 956 | if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) && |
@@ -962,14 +959,9 @@ static int dm_request(struct request_queue *q, struct bio *bio) | |||
962 | return 0; | 959 | return 0; |
963 | } | 960 | } |
964 | 961 | ||
965 | if (!queue_io(md, bio)) | 962 | queue_io(md, bio); |
966 | return 0; | ||
967 | 963 | ||
968 | /* | 964 | return 0; |
969 | * We're in a while loop, because someone could suspend | ||
970 | * before we get to the following read lock. | ||
971 | */ | ||
972 | down_read(&md->io_lock); | ||
973 | } | 965 | } |
974 | 966 | ||
975 | __split_and_process_bio(md, bio); | 967 | __split_and_process_bio(md, bio); |