lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <897fa571-14df-400f-b3b4-e5da2db4edae@huaweicloud.com>
Date: Sun, 4 Jan 2026 10:06:48 +0800
From: Zheng Qixing <zhengqixing@...weicloud.com>
To: John Stoffel <john@...ffel.org>
Cc: song@...nel.org, yukuai@...as.com, linux-raid@...r.kernel.org,
 linux-kernel@...r.kernel.org, yi.zhang@...wei.com, yangerkun@...wei.com,
 houtao1@...wei.com, linan122@...artners.com, zhengqixing@...wei.com
Subject: Re: [RFC PATCH 4/5] md: introduce MAX_RAID_DISKS macro to replace
 magic number

在 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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ