]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
md/raid0: set chunk_sectors limit
authorJohn Garry <john.g.garry@oracle.com>
Fri, 11 Jul 2025 10:52:55 +0000 (10:52 +0000)
committerJens Axboe <axboe@kernel.dk>
Thu, 17 Jul 2025 12:01:16 +0000 (06:01 -0600)
Currently we use min io size as the chunk size when deciding on the
atomic write size limits - see blk_stack_atomic_writes_head().

The limit min_io size is not a reliable value to store the chunk size, as
this may be mutated by the block stacking code. Such an example would be
for the min io size less than the physical block size, and the min io size
is raised to the physical block size - see blk_stack_limits().

The block stacking limits will rely on chunk_sectors in future,
so set this value (to the chunk size).

Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20250711105258.3135198-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid0.c

index d8f639f4ae123567b869d00ee620afd9953c9a8c..cbe2a9054cb91d4c330103fc7e4b53c6dfabb448 100644 (file)
@@ -384,6 +384,7 @@ static int raid0_set_limits(struct mddev *mddev)
        lim.max_write_zeroes_sectors = mddev->chunk_sectors;
        lim.io_min = mddev->chunk_sectors << 9;
        lim.io_opt = lim.io_min * mddev->raid_disks;
+       lim.chunk_sectors = mddev->chunk_sectors;
        lim.features |= BLK_FEAT_ATOMIC_WRITES;
        err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY);
        if (err)