Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142894
b: refs/heads/master
c: 92c6390
h: refs/heads/master
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Apr 8, 2009
1 parent d8009e1 commit fb53486
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3b00b2036fac7a7667d0676a0f80eee575b8c32b
refs/heads/master: 92c639021ca6e962645114f02e356e7feb131d0b
22 changes: 7 additions & 15 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,21 +436,18 @@ static void end_io_acct(struct dm_io *io)
/*
* Add the bio to the list of deferred io.
*/
static int queue_io(struct mapped_device *md, struct bio *bio)
static void queue_io(struct mapped_device *md, struct bio *bio)
{
down_write(&md->io_lock);

if (!test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) {
up_write(&md->io_lock);
return 1;
}

spin_lock_irq(&md->deferred_lock);
bio_list_add(&md->deferred, bio);
spin_unlock_irq(&md->deferred_lock);

if (!test_and_set_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags))
queue_work(md->wq, &md->work);

up_write(&md->io_lock);
return 0; /* deferred successfully */
}

/*
Expand Down Expand Up @@ -953,7 +950,7 @@ static int dm_request(struct request_queue *q, struct bio *bio)
* If we're suspended or the thread is processing barriers
* we have to queue this io for later.
*/
while (test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) {
if (unlikely(test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags))) {
up_read(&md->io_lock);

if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) &&
Expand All @@ -962,14 +959,9 @@ static int dm_request(struct request_queue *q, struct bio *bio)
return 0;
}

if (!queue_io(md, bio))
return 0;
queue_io(md, bio);

/*
* We're in a while loop, because someone could suspend
* before we get to the following read lock.
*/
down_read(&md->io_lock);
return 0;
}

__split_and_process_bio(md, bio);
Expand Down

0 comments on commit fb53486

Please sign in to comment.