Commit c7149d6bce2561aeaa48caaa1700aa8b3b22008f

Authored by Alan D. Brunelle
Committed by Jens Axboe
1 parent ec05b297f9

Fix remap handling by blktrace

This patch provides more information concerning REMAP operations on block
IOs. The additional information provides clearer details at the user level,
and supports post-processing analysis in btt.

o  Adds in partition remaps on the same device.
o  Fixed up the remap information in DM to be in the right order
o  Sent up mapped-from and mapped-to device information

Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 3 changed files with 8 additions and 3 deletions Side-by-side Diff

... ... @@ -3047,6 +3047,10 @@
3047 3047  
3048 3048 bio->bi_sector += p->start_sect;
3049 3049 bio->bi_bdev = bdev->bd_contains;
  3050 +
  3051 + blk_add_trace_remap(bdev_get_queue(bio->bi_bdev), bio,
  3052 + bdev->bd_dev, bio->bi_sector,
  3053 + bio->bi_sector - p->start_sect);
3050 3054 }
3051 3055 }
3052 3056  
... ... @@ -580,8 +580,8 @@
580 580 /* the bio has been remapped so dispatch it */
581 581  
582 582 blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone,
583   - tio->io->bio->bi_bdev->bd_dev, sector,
584   - clone->bi_sector);
  583 + tio->io->bio->bi_bdev->bd_dev,
  584 + clone->bi_sector, sector);
585 585  
586 586 generic_make_request(clone);
587 587 } else if (r < 0 || r == DM_MAPIO_REQUEUE) {
include/linux/blktrace_api.h
... ... @@ -105,7 +105,7 @@
105 105 */
106 106 struct blk_io_trace_remap {
107 107 __be32 device;
108   - u32 __pad;
  108 + __be32 device_from;
109 109 __be64 sector;
110 110 };
111 111  
... ... @@ -272,6 +272,7 @@
272 272 return;
273 273  
274 274 r.device = cpu_to_be32(dev);
  275 + r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
275 276 r.sector = cpu_to_be64(to);
276 277  
277 278 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);