diff options
author | Christoph Hellwig <hch@lst.de> | 2024-03-03 15:01:42 +0100 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2024-03-06 17:59:53 +0100 |
commit | 176df894d7974166c65d0cce3b3b019678f9e698 (patch) | |
tree | 0974ddbd3a00c500268df57aa16a702717fea92e /drivers/md/raid1.c | |
parent | md: add a mddev_add_trace_msg helper (diff) | |
download | linux-176df894d7974166c65d0cce3b3b019678f9e698.tar.xz linux-176df894d7974166c65d0cce3b3b019678f9e698.zip |
md: add a mddev_is_dm helper
Add a helper to check for a DM-mapped MD device instead of using
the obfuscated ->gendisk or ->queue NULL checks.
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-4-hch@lst.de
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 05870a4565fc..dd1393d0f084 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1926,7 +1926,7 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev) for (mirror = first; mirror <= last; mirror++) { p = conf->mirrors + mirror; if (!p->rdev) { - if (mddev->gendisk) + if (!mddev_is_dm(mddev)) disk_stack_limits(mddev->gendisk, rdev->bdev, rdev->data_offset << 9); @@ -3227,14 +3227,11 @@ static int raid1_run(struct mddev *mddev) if (IS_ERR(conf)) return PTR_ERR(conf); - if (mddev->queue) + if (!mddev_is_dm(mddev)) { blk_queue_max_write_zeroes_sectors(mddev->queue, 0); - - rdev_for_each(rdev, mddev) { - if (!mddev->gendisk) - continue; - disk_stack_limits(mddev->gendisk, rdev->bdev, - rdev->data_offset << 9); + rdev_for_each(rdev, mddev) + disk_stack_limits(mddev->gendisk, rdev->bdev, + rdev->data_offset << 9); } mddev->degraded = 0; |