Skip to content

Commit 1b1788c

Browse files
committed
md: factor out a helper raid_is_456()
JIRA: https://issues.redhat.com/browse/RHEL-123668 commit 7797da1 Author: Yu Kuai <yukuai3@huawei.com> Date: Fri Aug 29 16:04:17 2025 +0800 md: factor out a helper raid_is_456() There are no functional changes, the helper will be used by llbitmap in following patches. Link: https://lore.kernel.org/linux-raid/20250829080426.1441678-3-yukuai1@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Xiao Ni <xni@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Li Nan <linan122@huawei.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
1 parent e051a8b commit 1b1788c

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

drivers/md/md.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9084,19 +9084,12 @@ static sector_t md_sync_position(struct mddev *mddev, enum sync_action action)
90849084

90859085
static bool sync_io_within_limit(struct mddev *mddev)
90869086
{
9087-
int io_sectors;
9088-
90899087
/*
90909088
* For raid456, sync IO is stripe(4k) per IO, for other levels, it's
90919089
* RESYNC_PAGES(64k) per IO.
90929090
*/
9093-
if (mddev->level == 4 || mddev->level == 5 || mddev->level == 6)
9094-
io_sectors = 8;
9095-
else
9096-
io_sectors = 128;
9097-
90989091
return atomic_read(&mddev->recovery_active) <
9099-
io_sectors * sync_io_depth(mddev);
9092+
(raid_is_456(mddev) ? 8 : 128) * sync_io_depth(mddev);
91009093
}
91019094

91029095
#define SYNC_MARKS 10

drivers/md/md.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,12 @@ static inline bool mddev_is_dm(struct mddev *mddev)
10341034
return !mddev->gendisk;
10351035
}
10361036

1037+
static inline bool raid_is_456(struct mddev *mddev)
1038+
{
1039+
return mddev->level == ID_RAID4 || mddev->level == ID_RAID5 ||
1040+
mddev->level == ID_RAID6;
1041+
}
1042+
10371043
static inline void mddev_trace_remap(struct mddev *mddev, struct bio *bio,
10381044
sector_t sector)
10391045
{

0 commit comments

Comments
 (0)