Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

md/raid0: Move queue limit setup before r0conf initialization

Prepare for making logical blocksize configurable. This change has no
impact until logical block size becomes configurable.

Move raid0_set_limits() before create_strip_zones(). It is safe as fields
modified in create_strip_zones() do not involve mddev configuration, and
rdev modifications there are not used in raid0_set_limits().

'blksize' in create_strip_zones() fetches mddev's logical block size,
which is already the maximum aross all rdevs, so the later max() can be
removed.

Link: https://lore.kernel.org/linux-raid/20251103125757.1405796-4-linan666@huaweicloud.com
Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Yu Kuai <yukuai@fnnas.com>

authored by

Li Nan and committed by
Yu Kuai
2107457e 381a3ce1

+7 -9
+7 -9
drivers/md/raid0.c
··· 68 68 struct strip_zone *zone; 69 69 int cnt; 70 70 struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); 71 - unsigned blksize = 512; 71 + unsigned int blksize = queue_logical_block_size(mddev->gendisk->queue); 72 72 73 73 *private_conf = ERR_PTR(-ENOMEM); 74 74 if (!conf) ··· 83 83 sectors = rdev1->sectors; 84 84 sector_div(sectors, mddev->chunk_sectors); 85 85 rdev1->sectors = sectors * mddev->chunk_sectors; 86 - 87 - blksize = max(blksize, queue_logical_block_size( 88 - rdev1->bdev->bd_disk->queue)); 89 86 90 87 rdev_for_each(rdev2, mddev) { 91 88 pr_debug("md/raid0:%s: comparing %pg(%llu)" ··· 402 405 if (md_check_no_bitmap(mddev)) 403 406 return -EINVAL; 404 407 408 + if (!mddev_is_dm(mddev)) { 409 + ret = raid0_set_limits(mddev); 410 + if (ret) 411 + return ret; 412 + } 413 + 405 414 /* if private is not null, we are here after takeover */ 406 415 if (mddev->private == NULL) { 407 416 ret = create_strip_zones(mddev, &conf); ··· 416 413 mddev->private = conf; 417 414 } 418 415 conf = mddev->private; 419 - if (!mddev_is_dm(mddev)) { 420 - ret = raid0_set_limits(mddev); 421 - if (ret) 422 - return ret; 423 - } 424 416 425 417 /* calculate array device size */ 426 418 md_set_array_sectors(mddev, raid0_size(mddev, 0, 0));