Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm mpath: pass IO start time to path selector

The HST path selector needs this information to perform path
prediction. For request-based mpath, struct request's io_start_time_ns
is used, while for bio-based, use the start_time stored in dm_io.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Gabriel Krisman Bertazi and committed by
Mike Snitzer
087615bf 48338daa

+20 -6
+6 -3
drivers/md/dm-mpath.c
··· 567 567 if (pgpath && pgpath->pg->ps.type->end_io) 568 568 pgpath->pg->ps.type->end_io(&pgpath->pg->ps, 569 569 &pgpath->path, 570 - mpio->nr_bytes); 570 + mpio->nr_bytes, 571 + clone->io_start_time_ns); 571 572 } 572 573 573 574 blk_put_request(clone); ··· 1618 1617 struct path_selector *ps = &pgpath->pg->ps; 1619 1618 1620 1619 if (ps->type->end_io) 1621 - ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes); 1620 + ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes, 1621 + clone->io_start_time_ns); 1622 1622 } 1623 1623 1624 1624 return r; ··· 1663 1661 struct path_selector *ps = &pgpath->pg->ps; 1664 1662 1665 1663 if (ps->type->end_io) 1666 - ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes); 1664 + ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes, 1665 + dm_start_time_ns_from_clone(clone)); 1667 1666 } 1668 1667 1669 1668 return r;
+1 -1
drivers/md/dm-path-selector.h
··· 74 74 int (*start_io) (struct path_selector *ps, struct dm_path *path, 75 75 size_t nr_bytes); 76 76 int (*end_io) (struct path_selector *ps, struct dm_path *path, 77 - size_t nr_bytes); 77 + size_t nr_bytes, u64 start_time); 78 78 }; 79 79 80 80 /* Register a path selector */
+1 -1
drivers/md/dm-queue-length.c
··· 227 227 } 228 228 229 229 static int ql_end_io(struct path_selector *ps, struct dm_path *path, 230 - size_t nr_bytes) 230 + size_t nr_bytes, u64 start_time) 231 231 { 232 232 struct path_info *pi = path->pscontext; 233 233
+1 -1
drivers/md/dm-service-time.c
··· 309 309 } 310 310 311 311 static int st_end_io(struct path_selector *ps, struct dm_path *path, 312 - size_t nr_bytes) 312 + size_t nr_bytes, u64 start_time) 313 313 { 314 314 struct path_info *pi = path->pscontext; 315 315
+9
drivers/md/dm.c
··· 675 675 return md_in_flight_bios(md); 676 676 } 677 677 678 + u64 dm_start_time_ns_from_clone(struct bio *bio) 679 + { 680 + struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); 681 + struct dm_io *io = tio->io; 682 + 683 + return jiffies_to_nsecs(io->start_time); 684 + } 685 + EXPORT_SYMBOL_GPL(dm_start_time_ns_from_clone); 686 + 678 687 static void start_io_acct(struct dm_io *io) 679 688 { 680 689 struct mapped_device *md = io->md;
+2
include/linux/device-mapper.h
··· 332 332 struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size); 333 333 unsigned dm_bio_get_target_bio_nr(const struct bio *bio); 334 334 335 + u64 dm_start_time_ns_from_clone(struct bio *bio); 336 + 335 337 int dm_register_target(struct target_type *t); 336 338 void dm_unregister_target(struct target_type *t); 337 339