summaryrefslogtreecommitdiff
path: root/drivers/md/dm-core.h
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2022-02-17 23:40:32 -0500
committerMike Snitzer <snitzer@redhat.com>2022-02-21 15:36:33 -0500
commit0fbb4d93b38bce1f8235aacfa37e90ad8f011473 (patch)
tree0e952a46f944ff4559ebfd5d0579b1d766ef54cb /drivers/md/dm-core.h
parente6fc9f62ce6e412acb1699a5373174aa42ca2bd3 (diff)
dm: add dm_submit_bio_remap interface
Where possible, switch from early bio-based IO accounting (at the time DM clones each incoming bio) to late IO accounting just before each remapped bio is issued to underlying device via submit_bio_noacct(). Allows more precise bio-based IO accounting for DM targets that use their own workqueues to perform additional processing of each bio in conjunction with their DM_MAPIO_SUBMITTED return from their map function. When a target is updated to use dm_submit_bio_remap() they must also set ti->accounts_remapped_io to true. Use xchg() in start_io_acct(), as suggested by Mikulas, to ensure each IO is only started once. The xchg race only happens if __send_duplicate_bios() sends multiple bios -- that case is reflected via tio->is_duplicate_bio. Given the niche nature of this race, it is best to avoid any xchg performance penalty for normal IO. For IO that was never submitted with dm_bio_submit_remap(), but the target completes the clone with bio_endio, accounting is started then ended and pending_io counter decremented. Reviewed-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-core.h')
-rw-r--r--drivers/md/dm-core.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h
index 33ef92e90462..8078b6c155ef 100644
--- a/drivers/md/dm-core.h
+++ b/drivers/md/dm-core.h
@@ -232,6 +232,8 @@ struct dm_io {
struct mapped_device *md;
struct bio *orig_bio;
blk_status_t status;
+ bool start_io_acct:1;
+ int was_accounted;
unsigned long start_time;
spinlock_t endio_lock;
struct dm_stats_aux stats_aux;