aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2008-11-13 18:39:10 -0500
committerAlasdair G Kergon <agk@redhat.com>2008-11-13 18:39:10 -0500
commitd221d2e77696e70e94b13989ea15db2ba5b34f8e (patch)
tree82afcee59db83104d31848e2304eb51baeee3aa4 /drivers/md/dm.c
parent14e98c5ca8bed825f65cbf11cb0ffd2c09dac2f4 (diff)
dm: move pending queue wake_up end_io_acct
This doesn't fix any bug, just moves wake_up immediately after decrementing md->pending, for better code readability. It must be clear to anyone manipulating md->pending to wake up the queue if md->pending reaches zero, so move the wakeup as close to the decrementing as possible. 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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6963ad148408..dc25d8a07bc7 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
378static int end_io_acct(struct dm_io *io) 378static 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,