# \[Patch v1 1/4\] md/raid5: MAX\_DISKS define

- From: \<hidden\>
- Date: 2015-08-07 20:21:00 
- List: linux-raid
- Page: https://ratatoskr.run/linux-raid/2015/08/6630201
- Thread: https://ratatoskr.run/linux-raid/2015/08/6630201/t.md

```text
md/raid5: MAX_DISKS define

The maximum number of disks raid5 can handle is not clearly defined.
To avoid arbitrary values at several places introduce a new constant.

Signed-off-by: Markus Stockhausen <redacted>

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 643d217..817d125 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7722,7 +7722,7 @@ static void *raid6_takeover(struct mddev *mddev)
 		return ERR_PTR(-EINVAL);
 	if (mddev->degraded > 1)
 		return ERR_PTR(-EINVAL);
-	if (mddev->raid_disks > 253)
+	if (mddev->raid_disks >= MAX_DISKS)
 		return ERR_PTR(-EINVAL);
 	if (mddev->raid_disks < 3)
 		return ERR_PTR(-EINVAL);
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index d051442..112545b 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -542,6 +542,11 @@ struct r5conf {
 	int			worker_cnt_per_group;
 };
 
+/*
+ * Number of disks a raid456 device can support. Regarding physical constraints
+ * this is only a theoretical value. Nevertheless it improves readability
+ */
+#define MAX_DISKS 254
 
 /*
  * Our supported algorithms


```

## Attachments

- [InterScan\_Disclaimer.txt](https://ratatoskr.run/linux-raid/2015/08/6630201/attachment/0) (text/plain, 1694 bytes)
