]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Use dm_target_offset() and support discards.
authorMike Snitzer <snitzer@redhat.com>
Tue, 2 Aug 2011 00:25:24 +0000 (10:25 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 2 Aug 2011 00:25:24 +0000 (10:25 +1000)
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-flakey.c

index ea790623c30ba0d7522905d6f77f7db95c0cdebd..70a69b2f93d2f8d46ff03318d863b53fe9f90722 100644 (file)
@@ -79,6 +79,7 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        }
 
        ti->num_flush_requests = 1;
+       ti->num_discard_requests = 1;
        ti->private = fc;
        return 0;
 
@@ -99,7 +100,7 @@ static sector_t flakey_map_sector(struct dm_target *ti, sector_t bi_sector)
 {
        struct flakey_c *fc = ti->private;
 
-       return fc->start + (bi_sector - ti->begin);
+       return fc->start + dm_target_offset(ti, bi_sector);
 }
 
 static void flakey_map_bio(struct dm_target *ti, struct bio *bio)