1 From 4bbf3771ca40d0aaec8316d0e7476b16010288e5 Mon Sep 17 00:00:00 2001
2 From: NeilBrown <neilb@suse.de>
3 Date: Mon, 13 Oct 2008 11:55:12 +1100
4 Subject: [PATCH] md: Relax minimum size restrictions on chunk_size.
6 Currently, the 'chunk_size' of an array must be at-least PAGE_SIZE.
8 This makes moving an array to a machine with a larger PAGE_SIZE, or
9 changing the kernel to use a larger PAGE_SIZE, can stop an array from
12 For RAID10 and RAID4/5/6, this is non-trivial to fix as the resync
13 process works on whole pages at a time, and assumes them to be wholly
14 within a stripe. For other raid personalities, this restriction is
15 not needed at all and can be dropped.
17 So remove the test on chunk_size from common can, and add it in just
18 the places where it is needed: raid10 and raid4/5/6.
20 Signed-off-by: NeilBrown <neilb@suse.de>
22 drivers/md/md.c | 12 +-----------
23 drivers/md/raid10.c | 5 +++--
24 drivers/md/raid5.c | 7 +++++++
25 3 files changed, 11 insertions(+), 13 deletions(-)
27 --- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/md.c
28 +++ linux-2.6.27-SLE11_BRANCH/drivers/md/md.c
29 @@ -3580,22 +3580,12 @@ static int do_md_run(mddev_t * mddev)
33 - * chunk-size has to be a power of 2 and multiples of PAGE_SIZE
34 + * chunk-size has to be a power of 2
36 if ( (1 << ffz(~chunk_size)) != chunk_size) {
37 printk(KERN_ERR "chunk_size of %d not valid\n", chunk_size);
40 - if (chunk_size < PAGE_SIZE) {
41 - if (mddev->level != 0 && mddev->level != 1) {
42 - printk(KERN_ERR "too small chunk_size: %d < %ld\n",
43 - chunk_size, PAGE_SIZE);
46 - printk(KERN_ERR "too small chunk_size: %d < %ld, but continuing anyway on raid%d. Good luck!\n",
47 - chunk_size, PAGE_SIZE, mddev->level);
51 /* devices must have minimum size of one chunk */
52 rdev_for_each(rdev, tmp, mddev) {
53 --- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/raid10.c
54 +++ linux-2.6.27-SLE11_BRANCH/drivers/md/raid10.c
55 @@ -2025,8 +2025,9 @@ static int run(mddev_t *mddev)
57 sector_t stride, size;
59 - if (mddev->chunk_size == 0) {
60 - printk(KERN_ERR "md/raid10: non-zero chunk size required.\n");
61 + if (mddev->chunk_size < PAGE_SIZE) {
62 + printk(KERN_ERR "md/raid10: chunk size must be "
63 + "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
67 --- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/raid5.c
68 +++ linux-2.6.27-SLE11_BRANCH/drivers/md/raid5.c
69 @@ -4010,6 +4010,13 @@ static int run(mddev_t *mddev)
73 + if (mddev->chunk_size < PAGE_SIZE) {
74 + printk(KERN_ERR "md/raid5: chunk_size must be at least "
75 + "PAGE_SIZE but %d < %ld\n",
76 + mddev->chunk_size, PAGE_SIZE);
80 if (mddev->reshape_position != MaxSector) {
81 /* Check that we can continue the reshape.
82 * Currently only disks can change, it must