This helper will be used by personalities that want to align bio to
io_opt to get best IO bandwidth.
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
---
drivers/md/md.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 1ed90fd85ac4..c8190cf02701 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -1088,6 +1088,17 @@ static inline bool rdev_blocked(struct md_rdev *rdev)
return false;
}
+static inline void md_config_align_limits(struct mddev *mddev,
+ struct queue_limits *lim)
+{
+ if ((lim->max_hw_sectors << 9) < lim->io_opt)
+ lim->max_hw_sectors = lim->io_opt >> 9;
+ else
+ lim->max_hw_sectors = rounddown(lim->max_hw_sectors,
+ lim->io_opt >> 9);
+ mddev->bio_align_to_limits = true;
+}
+
#define mddev_add_trace_msg(mddev, fmt, args...) \
do { \
if (!mddev_is_dm(mddev)) \
--
2.51.0