summaryrefslogtreecommitdiff
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-03-03 07:01:40 -0700
committerSong Liu <song@kernel.org>2024-03-06 08:59:52 -0800
commitc396b90e502691fc6ff7b43984cfd9d1b15aaa80 (patch)
tree9c36ee2b90f098178645ada275d2c936cfaa8086 /drivers/md/md.h
parent3a889fdce7e8927a7d81d11ca3d26608b3be1c31 (diff)
md: add a mddev_trace_remap helper
Add a helper to trace bio remapping that hides some argument dereferences and the check for a DM-mapped MD device. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed--by: Song Liu <song@kernel.org> Tested-by: Song Liu <song@kernel.org> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20240303140150.5435-2-hch@lst.de
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r--drivers/md/md.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 556db28a49aa..928086b638a3 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -18,6 +18,7 @@
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
+#include <trace/events/block.h>
#include "md-cluster.h"
#define MaxSector (~(sector_t)0)
@@ -910,4 +911,11 @@ int do_md_run(struct mddev *mddev);
extern const struct block_device_operations md_fops;
+static inline void mddev_trace_remap(struct mddev *mddev, struct bio *bio,
+ sector_t sector)
+{
+ if (mddev->gendisk)
+ trace_block_bio_remap(bio, disk_devt(mddev->gendisk), sector);
+}
+
#endif /* _MD_MD_H */