From: Zheng Qixing <zhengqixing@huaweicloud.com>
To: John Stoffel <john@stoffel.org>
Cc: song@kernel.org, yukuai@fnnas.com, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
yangerkun@huawei.com, houtao1@huawei.com,
linan122@h-partners.com, zhengqixing@huawei.com
Subject: Re: [RFC PATCH 4/5] md: introduce MAX_RAID_DISKS macro to replace magic number
Date: Sun, 4 Jan 2026 10:06:48 +0800 [thread overview]
Message-ID: <897fa571-14df-400f-b3b4-e5da2db4edae@huaweicloud.com> (raw)
In-Reply-To: <26965.25787.328101.504732@quad.stoffel.home>
在 2026/1/1 2:00, John Stoffel 写道:
>> #define MaxSector (~(sector_t)0)
>> +#define MAX_RAID_DISKS ((4096-256)/2)
> Looks fine to me, except there's no explanation for the magic numbers
> here. Sure, it's 1916 devices max, but WHY? Other than that nit,
> looks fine.
>
In include/uapi/linux/raid/md_p.h :
/*
* The version-1 superblock :
* All numeric fields are little-endian.
*
* total size: 256 bytes plus 2 per device.
* 1K allows 384 devices.
*/
struct mdp_superblock_1 {
1.x superblock:
Per-device state is stored as a __u16 dev_roles[] array (2 bytes per
device) plus a fixed 256-byte header, still within a 4 KiB superblock.
Therefore the theoretical maximum is (4096 - 256) / 2 = 1920 entries.
0.90 superblock (27 devices):
The superblock is fixed at 4 KiB (1024 32-bit words). It must store
several fixed sections (generic + personality) and also reserves space
for one “this_disk” descriptor in addition to the per-member disks[]
table. Each member descriptor consumes 32 words = 128 bytes. After
accounting for the fixed sections and the extra descriptor, the
remaining space fits exactly 27 member descriptors.
Best regards,
Qixing
next prev parent reply other threads:[~2026-01-04 2:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-31 7:09 [RFC PATCH 0/5] md/raid1: introduce a new sync action to repair badblocks Zheng Qixing
2025-12-31 7:09 ` [RFC PATCH 1/5] md: add helpers for requested sync action Zheng Qixing
2026-01-06 12:59 ` Li Nan
2026-01-08 3:31 ` Zheng Qixing
2025-12-31 7:09 ` [RFC PATCH 2/5] md: clear stale sync flags when frozen before sync starts Zheng Qixing
2026-01-06 13:07 ` Li Nan
2025-12-31 7:09 ` [RFC PATCH 3/5] md: simplify sync action print in status_resync Zheng Qixing
2026-01-06 13:24 ` Li Nan
2025-12-31 7:09 ` [RFC PATCH 4/5] md: introduce MAX_RAID_DISKS macro to replace magic number Zheng Qixing
2025-12-31 18:00 ` John Stoffel
2026-01-04 2:06 ` Zheng Qixing [this message]
2025-12-31 7:09 ` [RFC PATCH 5/5] md/raid1: introduce rectify action to repair badblocks Zheng Qixing
2026-01-06 13:43 ` Li Nan
2026-01-19 2:51 ` Zheng Qixing
2026-01-14 3:11 ` Li Nan
2026-01-19 3:06 ` Zheng Qixing
2025-12-31 11:11 ` [RFC PATCH 0/5] md/raid1: introduce a new sync " Roman Mamedov
2026-01-06 2:44 ` Zheng Qixing
2026-01-06 13:50 ` Roman Mamedov
2026-01-06 15:36 ` Pascal Hambourg
2026-01-08 1:32 ` Zheng Qixing
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=897fa571-14df-400f-b3b4-e5da2db4edae@huaweicloud.com \
--to=zhengqixing@huaweicloud.com \
--cc=houtao1@huawei.com \
--cc=john@stoffel.org \
--cc=linan122@h-partners.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai@fnnas.com \
--cc=zhengqixing@huawei.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
all inboxes | Powered by JetHome®