Commit 7fc8f632 authored by John Garry's avatar John Garry Committed by Yu Kuai
Browse files

md/md-linear: Enable atomic writes

All the infrastructure has already been plumbed to support this for
stacked devices, so just enable the request_queue limits features flag.

A note about chunk sectors for linear arrays:
While it is possible to set a chunk sectors param for building a linear
array, this is for specifying the granularity at which data sectors from
the device are used. It is not the same as a stripe size, like for RAID0.

As such, it is not appropriate to set chunk_sectors request queue limit to
the same value, as chunk_sectors request limit is a boundary for which
requests cannot straddle.

However, request_queue limit max_hw_sectors is set to chunk sectors, which
almost has the same effect as setting chunk_sectors limit.

Link: https://lore.kernel.org/linux-raid/20250903161052.3326176-1-john.g.garry@oracle.com


Signed-off-by: default avatarJohn Garry <john.g.garry@oracle.com>
Reviewed-by: default avatarYu Kuai <yukuai3@fnnas.com>
Signed-off-by: default avatarYu Kuai <yukuai@fnnas.com>
parent 082d680f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ static int linear_set_limits(struct mddev *mddev)
	lim.max_write_zeroes_sectors = mddev->chunk_sectors;
	lim.max_hw_wzeroes_unmap_sectors = mddev->chunk_sectors;
	lim.io_min = mddev->chunk_sectors << 9;
	lim.features |= BLK_FEAT_ATOMIC_WRITES;
	err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY);
	if (err)
		return err;