]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.fixes/0001-md-Relax-minimum-size-restrictions-on-chunk_size.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / 0001-md-Relax-minimum-size-restrictions-on-chunk_size.patch
diff --git a/src/patches/suse-2.6.27.31/patches.fixes/0001-md-Relax-minimum-size-restrictions-on-chunk_size.patch b/src/patches/suse-2.6.27.31/patches.fixes/0001-md-Relax-minimum-size-restrictions-on-chunk_size.patch
new file mode 100644 (file)
index 0000000..41987bb
--- /dev/null
@@ -0,0 +1,82 @@
+From 4bbf3771ca40d0aaec8316d0e7476b16010288e5 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Mon, 13 Oct 2008 11:55:12 +1100
+Subject: [PATCH] md: Relax minimum size restrictions on chunk_size.
+
+Currently, the 'chunk_size' of an array must be at-least PAGE_SIZE.
+
+This makes moving an array to a machine with a larger PAGE_SIZE, or
+changing the kernel to use a larger PAGE_SIZE, can stop an array from
+working.
+
+For RAID10 and RAID4/5/6, this is non-trivial to fix as the resync
+process works on whole pages at a time, and assumes them to be wholly
+within a stripe.  For other raid personalities, this restriction is
+not needed at all and can be dropped.
+
+So remove the test on chunk_size from common can, and add it in just
+the places where it is needed: raid10 and raid4/5/6.
+
+Signed-off-by: NeilBrown <neilb@suse.de>
+---
+ drivers/md/md.c     |   12 +-----------
+ drivers/md/raid10.c |    5 +++--
+ drivers/md/raid5.c  |    7 +++++++
+ 3 files changed, 11 insertions(+), 13 deletions(-)
+
+--- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/md.c
++++ linux-2.6.27-SLE11_BRANCH/drivers/md/md.c
+@@ -3580,22 +3580,12 @@ static int do_md_run(mddev_t * mddev)
+                       return -EINVAL;
+               }
+               /*
+-               * chunk-size has to be a power of 2 and multiples of PAGE_SIZE
++               * chunk-size has to be a power of 2
+                */
+               if ( (1 << ffz(~chunk_size)) != chunk_size) {
+                       printk(KERN_ERR "chunk_size of %d not valid\n", chunk_size);
+                       return -EINVAL;
+               }
+-              if (chunk_size < PAGE_SIZE) {
+-                      if (mddev->level != 0 && mddev->level != 1) {
+-                      printk(KERN_ERR "too small chunk_size: %d < %ld\n",
+-                              chunk_size, PAGE_SIZE);
+-                      return -EINVAL;
+-                      } else {
+-                              printk(KERN_ERR "too small chunk_size: %d < %ld, but continuing anyway on raid%d. Good luck!\n",
+-                                      chunk_size, PAGE_SIZE, mddev->level);
+-                      }
+-              }
+               /* devices must have minimum size of one chunk */
+               rdev_for_each(rdev, tmp, mddev) {
+--- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/raid10.c
++++ linux-2.6.27-SLE11_BRANCH/drivers/md/raid10.c
+@@ -2025,8 +2025,9 @@ static int run(mddev_t *mddev)
+       int nc, fc, fo;
+       sector_t stride, size;
+-      if (mddev->chunk_size == 0) {
+-              printk(KERN_ERR "md/raid10: non-zero chunk size required.\n");
++      if (mddev->chunk_size < PAGE_SIZE) {
++              printk(KERN_ERR "md/raid10: chunk size must be "
++                     "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
+               return -EINVAL;
+       }
+--- linux-2.6.27-SLE11_BRANCH.orig/drivers/md/raid5.c
++++ linux-2.6.27-SLE11_BRANCH/drivers/md/raid5.c
+@@ -4010,6 +4010,13 @@ static int run(mddev_t *mddev)
+               return -EIO;
+       }
++      if (mddev->chunk_size < PAGE_SIZE) {
++              printk(KERN_ERR "md/raid5: chunk_size must be at least "
++                     "PAGE_SIZE but %d < %ld\n",
++                     mddev->chunk_size, PAGE_SIZE);
++              return -EINVAL;
++      }
++
+       if (mddev->reshape_position != MaxSector) {
+               /* Check that we can continue the reshape.
+                * Currently only disks can change, it must