public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: "John Stoffel" <john@stoffel.org>
To: Zheng Qixing <zhengqixing@huaweicloud.com>
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, zhengqixing@huawei.com,
	linan122@h-partners.com
Subject: Re: [RFC PATCH 4/5] md: introduce MAX_RAID_DISKS macro to replace magic number
Date: Wed, 31 Dec 2025 13:00:27 -0500	[thread overview]
Message-ID: <26965.25787.328101.504732@quad.stoffel.home> (raw)
In-Reply-To: <20251231070952.1233903-5-zhengqixing@huaweicloud.com>

>>>>> "Zheng" == Zheng Qixing <zhengqixing@huaweicloud.com> writes:

> From: Zheng Qixing <zhengqixing@huawei.com>

> Define MAX_RAID_DISKS macro for the maximum number of RAID disks.
> No functional change.

> Signed-off-by: Zheng Qixing <zhengqixing@huawei.com>
> ---
>  drivers/md/md.c | 4 ++--
>  drivers/md/md.h | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)

> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 9eeab5258189..d2f136706f6c 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1888,7 +1888,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
 
>  	if (sb->magic != cpu_to_le32(MD_SB_MAGIC) ||
sb-> major_version != cpu_to_le32(1) ||
> -	    le32_to_cpu(sb->max_dev) > (4096-256)/2 ||
> +	    le32_to_cpu(sb->max_dev) > MAX_RAID_DISKS ||
>  	    le64_to_cpu(sb->super_offset) != rdev->sb_start ||
>  	    (le32_to_cpu(sb->feature_map) & ~MD_FEATURE_ALL) != 0)
>  		return -EINVAL;
> @@ -2065,7 +2065,7 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *freshest, struc
mddev-> resync_offset = le64_to_cpu(sb->resync_offset);
>  		memcpy(mddev->uuid, sb->set_uuid, 16);
 
> -		mddev->max_disks =  (4096-256)/2;
> +		mddev->max_disks = MAX_RAID_DISKS;
 
>  		if (!mddev->logical_block_size)
mddev-> logical_block_size = le32_to_cpu(sb->logical_block_size);
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index a083f37374d0..6a4af4a1959c 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -22,6 +22,7 @@
>  #include <trace/events/block.h>
 
>  #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. 


  reply	other threads:[~2025-12-31 18:09 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 [this message]
2026-01-04  2:06     ` Zheng Qixing
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=26965.25787.328101.504732@quad.stoffel.home \
    --to=john@stoffel.org \
    --cc=houtao1@huawei.com \
    --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 \
    --cc=zhengqixing@huaweicloud.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