linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Nan <linan666@huaweicloud.com>
To: Xiao Ni <xni@redhat.com>, linan666@huaweicloud.com
Cc: corbet@lwn.net, song@kernel.org, yukuai@fnnas.com, hare@suse.de,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org, yangerkun@huawei.com,
	yi.zhang@huawei.com
Subject: Re: [PATCH v8 4/4] md: allow configuring logical block size
Date: Mon, 3 Nov 2025 21:09:04 +0800	[thread overview]
Message-ID: <358b8933-952e-0e4b-e708-c40ca98ae7d7@huaweicloud.com> (raw)
In-Reply-To: <CALTww28r_bicJ_4jcxQ7MB2hLVX5nAZkY3tuM7q7HY_D2beHFA@mail.gmail.com>



在 2025/11/3 11:11, Xiao Ni 写道:
> On Thu, Oct 30, 2025 at 2:36 PM <linan666@huaweicloud.com> wrote:
>>
>> From: Li Nan <linan122@huawei.com>
>>
>> Previously, raid array used the maximum logical block size (LBS)
>> of all member disks. Adding a larger LBS disk at runtime could
>> unexpectedly increase RAID's LBS, risking corruption of existing
>> partitions. This can be reproduced by:
>>
>> ```
>>    # LBS of sd[de] is 512 bytes, sdf is 4096 bytes.
>>    mdadm -CRq /dev/md0 -l1 -n3 /dev/sd[de] missing --assume-clean
>>
>>    # LBS is 512
>>    cat /sys/block/md0/queue/logical_block_size
>>
>>    # create partition md0p1
>>    parted -s /dev/md0 mklabel gpt mkpart primary 1MiB 100%
>>    lsblk | grep md0p1
>>
>>    # LBS becomes 4096 after adding sdf
>>    mdadm --add -q /dev/md0 /dev/sdf
>>    cat /sys/block/md0/queue/logical_block_size
>>
>>    # partition lost
>>    partprobe /dev/md0
>>    lsblk | grep md0p1
>> ```
>>
>> Simply restricting larger-LBS disks is inflexible. In some scenarios,
>> only disks with 512 bytes LBS are available currently, but later, disks
>> with 4KB LBS may be added to the array.
>>
>> Making LBS configurable is the best way to solve this scenario.
>> After this patch, the raid will:
>>    - store LBS in disk metadata
>>    - add a read-write sysfs 'mdX/logical_block_size'
>>
>> Future mdadm should support setting LBS via metadata field during RAID
>> creation and the new sysfs. Though the kernel allows runtime LBS changes,
>> users should avoid modifying it after creating partitions or filesystems
>> to prevent compatibility issues.
>>
>> Only 1.x metadata supports configurable LBS. 0.90 metadata inits all
>> fields to default values at auto-detect. Supporting 0.90 would require
>> more extensive changes and no such use case has been observed.
>>
>> Note that many RAID paths rely on PAGE_SIZE alignment, including for
>> metadata I/O. A larger LBS than PAGE_SIZE will result in metadata
>> read/write failures. So this config should be prevented.
>>
>> Signed-off-by: Li Nan <linan122@huawei.com >
> Hi Li Nan
> 

Hi Xiao,

Thanks for your review.

> The problem can't be fixed if there is no user space (mdadm) patch, right?
> 

Yeah, mdadm should update same time. And Guanghao will send a mdadm patch
later.

> The patch Looks good to me.
> Reviewed-by: Xiao Ni <xni@redhat.com>
> 

Sorry for the trouble. I sent the v9 with some changes to the
Documentation. Could you please review v9 patch when you have time?

> 
> .


-- 
Thanks,
Nan


      reply	other threads:[~2025-11-03 13:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30  6:28 [PATCH v8 0/4] make logical block size configurable linan666
2025-10-30  6:28 ` [PATCH v8 1/4] md: delete md_redundancy_group when array is becoming inactive linan666
2025-11-03  0:27   ` Xiao Ni
2025-10-30  6:28 ` [PATCH v8 2/4] md: init bioset in mddev_init linan666
2025-11-03  1:23   ` Xiao Ni
2025-11-03 12:32     ` Li Nan
2025-11-04  1:20       ` Xiao Ni
2025-10-30  6:28 ` [PATCH v8 3/4] md/raid0: Move queue limit setup before r0conf initialization linan666
2025-11-03  1:47   ` Xiao Ni
2025-10-30  6:28 ` [PATCH v8 4/4] md: allow configuring logical block size linan666
2025-11-03  3:11   ` Xiao Ni
2025-11-03 13:09     ` Li Nan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=358b8933-952e-0e4b-e708-c40ca98ae7d7@huaweicloud.com \
    --to=linan666@huaweicloud.com \
    --cc=corbet@lwn.net \
    --cc=hare@suse.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=xni@redhat.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai@fnnas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).