dm delay: support barriers
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 22 Jun 2009 09:12:23 +0000 (10:12 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Mon, 22 Jun 2009 09:12:23 +0000 (10:12 +0100)
Flush support for dm-delay target.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-delay.c

index 559dbb52bc851039702692e201a00a700e402187..8ad8a9044bbfe0aa757361ad876778ce76d6bc8f 100644 (file)
@@ -197,6 +197,7 @@ out:
        mutex_init(&dc->timer_lock);
        atomic_set(&dc->may_delay, 1);
 
+       ti->num_flush_requests = 1;
        ti->private = dc;
        return 0;
 
@@ -278,8 +279,9 @@ static int delay_map(struct dm_target *ti, struct bio *bio,
 
        if ((bio_data_dir(bio) == WRITE) && (dc->dev_write)) {
                bio->bi_bdev = dc->dev_write->bdev;
-               bio->bi_sector = dc->start_write +
-                                (bio->bi_sector - ti->begin);
+               if (bio_sectors(bio))
+                       bio->bi_sector = dc->start_write +
+                                        (bio->bi_sector - ti->begin);
 
                return delay_bio(dc, dc->write_delay, bio);
        }