[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251121051406.1316884-6-yukuai@fnnas.com>
Date: Fri, 21 Nov 2025 13:14:03 +0800
From: Yu Kuai <yukuai@...as.com>
To: song@...nel.org,
yukuai@...as.com
Cc: linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org,
linan122@...wei.com,
xni@...hat.com
Subject: [PATCH 4/7] md: add a helper md_config_align_limits()
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@...as.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
Powered by blists - more mailing lists