Re: [PATCH v2 2/3] md: allow configuring logical_block_size

From: Yu Kuai
Date: Thu Jul 31 2025 - 03:02:25 EST


Hi,

在 2025/07/31 13:36, Martin K. Petersen 写道:

Simply restricting larger-LBS disks is inflexible. In some scenarios,
only disks with 512 LBS are available currently, but later, disks with
4k LBS may be added to the array.

Having to have the foresight to preemptively configure a larger logical
block size at creation time also seems somewhat inflexible :)

I think the main reason we want to do this is that, for example, if user
create array with 512 lbs disks, and later they may want be able to add
new disk with 4k lbs.

In general I am not a big fan of mixing devices with different
properties. I have regretted stacking the logical block size on several
occasions.

I am also concerned about PI breaking if the logical block size facing
upwards does not match the actual logical block size of the component
devices below. In theory it should work with the PI interval exponent
but it is something that needs to be tested.

What if the MD device's configured logical block size is larger than the
physical block size of the underlying devices? Then we'll end up
reporting a logical block size larger than the physical block size. Ugh.

I think this is not expected, from blk_validate_limits(), if lbs is
larger than pbs, pbs will be set to lbs, which is called from
queue_limits_commit_update().


Oh, and what about atomics?

Do you mean atomic writes? I didn't check the code yet, however, I think
the atomic_writes stacking code should notice if the high level lbs is
conflict with atomic_writes limits.

Thanks,
Kuai