Commit 743598f0 authored by Mike Snitzer's avatar Mike Snitzer

dm: record old_sector in dm_target_io before calling map function

Prep for being able to defer trace_block_bio_remap() until when the
bio is remapped and submitted by the DM target.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 77c11720
...@@ -216,6 +216,7 @@ struct dm_target_io { ...@@ -216,6 +216,7 @@ struct dm_target_io {
unsigned int target_bio_nr; unsigned int target_bio_nr;
unsigned int *len_ptr; unsigned int *len_ptr;
bool inside_dm_io; bool inside_dm_io;
sector_t old_sector;
struct bio clone; struct bio clone;
}; };
......
...@@ -584,6 +584,7 @@ static struct bio *alloc_tio(struct clone_info *ci, struct dm_target *ti, ...@@ -584,6 +584,7 @@ static struct bio *alloc_tio(struct clone_info *ci, struct dm_target *ti,
tio->ti = ti; tio->ti = ti;
tio->target_bio_nr = target_bio_nr; tio->target_bio_nr = target_bio_nr;
tio->len_ptr = len; tio->len_ptr = len;
tio->old_sector = 0;
return &tio->clone; return &tio->clone;
} }
...@@ -1139,7 +1140,6 @@ static void __map_bio(struct bio *clone) ...@@ -1139,7 +1140,6 @@ static void __map_bio(struct bio *clone)
{ {
struct dm_target_io *tio = clone_to_tio(clone); struct dm_target_io *tio = clone_to_tio(clone);
int r; int r;
sector_t sector;
struct dm_io *io = tio->io; struct dm_io *io = tio->io;
struct dm_target *ti = tio->ti; struct dm_target *ti = tio->ti;
...@@ -1151,7 +1151,7 @@ static void __map_bio(struct bio *clone) ...@@ -1151,7 +1151,7 @@ static void __map_bio(struct bio *clone)
* this io. * this io.
*/ */
dm_io_inc_pending(io); dm_io_inc_pending(io);
sector = clone->bi_iter.bi_sector; tio->old_sector = clone->bi_iter.bi_sector;
if (unlikely(swap_bios_limit(ti, clone))) { if (unlikely(swap_bios_limit(ti, clone))) {
struct mapped_device *md = io->md; struct mapped_device *md = io->md;
...@@ -1176,7 +1176,8 @@ static void __map_bio(struct bio *clone) ...@@ -1176,7 +1176,8 @@ static void __map_bio(struct bio *clone)
break; break;
case DM_MAPIO_REMAPPED: case DM_MAPIO_REMAPPED:
/* the bio has been remapped so dispatch it */ /* the bio has been remapped so dispatch it */
trace_block_bio_remap(clone, bio_dev(io->orig_bio), sector); trace_block_bio_remap(clone, bio_dev(io->orig_bio),
tio->old_sector);
submit_bio_noacct(clone); submit_bio_noacct(clone);
break; break;
case DM_MAPIO_KILL: case DM_MAPIO_KILL:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment