aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2010-08-11 23:14:11 -0400
committerAlasdair G Kergon <agk@redhat.com>2010-08-11 23:14:11 -0400
commitb441a262e7d1c56fbe21794c91d7a9c83809113f (patch)
treecc9acb2c3f7045ff513739fd81bba8a789d713b6 /drivers/md
parent56a67df766039666f61fb15b079f713e44a735ae (diff)
dm: use dm_target_offset macro
Use new dm_target_offset() macro to avoid most references to ti->begin in dm targets. Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-crypt.c4
-rw-r--r--drivers/md/dm-delay.c5
-rw-r--r--drivers/md/dm-linear.c2
-rw-r--r--drivers/md/dm-raid1.c2
-rw-r--r--drivers/md/dm-stripe.c2
5 files changed, 7 insertions, 8 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 6401bfa0adff..368e8e98f705 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1284,7 +1284,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio,
1284 return DM_MAPIO_REMAPPED; 1284 return DM_MAPIO_REMAPPED;
1285 } 1285 }
1286 1286
1287 io = crypt_io_alloc(ti, bio, bio->bi_sector - ti->begin); 1287 io = crypt_io_alloc(ti, bio, dm_target_offset(ti, bio->bi_sector));
1288 1288
1289 if (bio_data_dir(io->base_bio) == READ) 1289 if (bio_data_dir(io->base_bio) == READ)
1290 kcryptd_queue_io(io); 1290 kcryptd_queue_io(io);
@@ -1406,7 +1406,7 @@ static int crypt_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
1406 return max_size; 1406 return max_size;
1407 1407
1408 bvm->bi_bdev = cc->dev->bdev; 1408 bvm->bi_bdev = cc->dev->bdev;
1409 bvm->bi_sector = cc->start + bvm->bi_sector - ti->begin; 1409 bvm->bi_sector = cc->start + dm_target_offset(ti, bvm->bi_sector);
1410 1410
1411 return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); 1411 return min(max_size, q->merge_bvec_fn(q, bvm, biovec));
1412} 1412}
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index 852052880d7a..a91049e05219 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -281,14 +281,13 @@ static int delay_map(struct dm_target *ti, struct bio *bio,
281 bio->bi_bdev = dc->dev_write->bdev; 281 bio->bi_bdev = dc->dev_write->bdev;
282 if (bio_sectors(bio)) 282 if (bio_sectors(bio))
283 bio->bi_sector = dc->start_write + 283 bio->bi_sector = dc->start_write +
284 (bio->bi_sector - ti->begin); 284 dm_target_offset(ti, bio->bi_sector);
285 285
286 return delay_bio(dc, dc->write_delay, bio); 286 return delay_bio(dc, dc->write_delay, bio);
287 } 287 }
288 288
289 bio->bi_bdev = dc->dev_read->bdev; 289 bio->bi_bdev = dc->dev_read->bdev;
290 bio->bi_sector = dc->start_read + 290 bio->bi_sector = dc->start_read + dm_target_offset(ti, bio->bi_sector);
291 (bio->bi_sector - ti->begin);
292 291
293 return delay_bio(dc, dc->read_delay, bio); 292 return delay_bio(dc, dc->read_delay, bio);
294} 293}
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
index f043b5f433b2..3921e3bb43c1 100644
--- a/drivers/md/dm-linear.c
+++ b/drivers/md/dm-linear.c
@@ -74,7 +74,7 @@ static sector_t linear_map_sector(struct dm_target *ti, sector_t bi_sector)
74{ 74{
75 struct linear_c *lc = ti->private; 75 struct linear_c *lc = ti->private;
76 76
77 return lc->start + (bi_sector - ti->begin); 77 return lc->start + dm_target_offset(ti, bi_sector);
78} 78}
79 79
80static void linear_map_bio(struct dm_target *ti, struct bio *bio) 80static void linear_map_bio(struct dm_target *ti, struct bio *bio)
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 74136262d654..7c081bcbc3cf 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -445,7 +445,7 @@ static sector_t map_sector(struct mirror *m, struct bio *bio)
445{ 445{
446 if (unlikely(!bio->bi_size)) 446 if (unlikely(!bio->bi_size))
447 return 0; 447 return 0;
448 return m->offset + (bio->bi_sector - m->ms->ti->begin); 448 return m->offset + dm_target_offset(m->ms->ti, bio->bi_sector);
449} 449}
450 450
451static void map_bio(struct mirror *m, struct bio *bio) 451static void map_bio(struct mirror *m, struct bio *bio)
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index 22d5e2fdab8b..779f47a0fe71 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -222,7 +222,7 @@ static int stripe_map(struct dm_target *ti, struct bio *bio,
222 return DM_MAPIO_REMAPPED; 222 return DM_MAPIO_REMAPPED;
223 } 223 }
224 224
225 offset = bio->bi_sector - ti->begin; 225 offset = dm_target_offset(ti, bio->bi_sector);
226 chunk = offset >> sc->chunk_shift; 226 chunk = offset >> sc->chunk_shift;
227 stripe = sector_div(chunk, sc->stripes); 227 stripe = sector_div(chunk, sc->stripes);
228 228