Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142891
b: refs/heads/master
c: 1eb787e
h: refs/heads/master
i:
  142889: 8491c3b
  142887: ced66f0
v: v3
  • Loading branch information
Alasdair G Kergon committed Apr 8, 2009
1 parent 6f78712 commit f21766c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 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: df12ee996378a5917e9555169fe278ecca0612d4
refs/heads/master: 1eb787ec183d1267cac95aae632e92dee05ed50a
22 changes: 13 additions & 9 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ union map_info *dm_get_mapinfo(struct bio *bio)
/*
* Bits for the md->flags field.
*/
#define DMF_BLOCK_IO 0
#define DMF_BLOCK_IO_FOR_SUSPEND 0
#define DMF_SUSPENDED 1
#define DMF_FROZEN 2
#define DMF_FREEING 3
#define DMF_DELETING 4
#define DMF_NOFLUSH_SUSPENDING 5
#define DMF_QUEUE_IO_TO_THREAD 6

/*
* Work processed by per-device workqueue.
Expand Down Expand Up @@ -439,7 +440,7 @@ static int queue_io(struct mapped_device *md, struct bio *bio)
{
down_write(&md->io_lock);

if (!test_bit(DMF_BLOCK_IO, &md->flags)) {
if (!test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) {
up_write(&md->io_lock);
return 1;
}
Expand Down Expand Up @@ -950,10 +951,10 @@ static int dm_request(struct request_queue *q, struct bio *bio)
part_stat_unlock();

/*
* If we're suspended we have to queue
* this io for later.
* If we're suspended or the thread is processing barriers
* we have to queue this io for later.
*/
while (test_bit(DMF_BLOCK_IO, &md->flags)) {
while (test_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags)) {
up_read(&md->io_lock);

if (bio_rw(bio) != READA)
Expand Down Expand Up @@ -997,7 +998,7 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
struct mapped_device *md = congested_data;
struct dm_table *map;

if (!test_bit(DMF_BLOCK_IO, &md->flags)) {
if (!test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) {
map = dm_get_table(md);
if (map) {
r = dm_table_any_congested(map, bdi_bits);
Expand Down Expand Up @@ -1443,7 +1444,8 @@ static void dm_wq_work(struct work_struct *work)
spin_unlock_irq(&md->deferred_lock);

if (!c) {
clear_bit(DMF_BLOCK_IO, &md->flags);
clear_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags);
clear_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags);
break;
}

Expand Down Expand Up @@ -1574,10 +1576,12 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
}

/*
* First we set the BLOCK_IO flag so no more ios will be mapped.
* First we set the DMF_QUEUE_IO_TO_THREAD flag so no more ios
* will be mapped.
*/
down_write(&md->io_lock);
set_bit(DMF_BLOCK_IO, &md->flags);
set_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags);
set_bit(DMF_QUEUE_IO_TO_THREAD, &md->flags);

up_write(&md->io_lock);

Expand Down

0 comments on commit f21766c

Please sign in to comment.