]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.fixes/0001-md-Relax-minimum-size-restrictions-on-chunk_size.patch
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / 0001-md-Relax-minimum-size-restrictions-on-chunk_size.patch
CommitLineData
2cb7cef9
BS
1From 4bbf3771ca40d0aaec8316d0e7476b16010288e5 Mon Sep 17 00:00:00 2001
2From: NeilBrown <neilb@suse.de>
3Date: Mon, 13 Oct 2008 11:55:12 +1100
4Subject: [PATCH] md: Relax minimum size restrictions on chunk_size.
5
6Currently, the 'chunk_size' of an array must be at-least PAGE_SIZE.
7
8This makes moving an array to a machine with a larger PAGE_SIZE, or
9changing the kernel to use a larger PAGE_SIZE, can stop an array from
10working.
11
12For RAID10 and RAID4/5/6, this is non-trivial to fix as the resync
13process works on whole pages at a time, and assumes them to be wholly
14within a stripe. For other raid personalities, this restriction is
15not needed at all and can be dropped.
16
17So remove the test on chunk_size from common can, and add it in just
18the places where it is needed: raid10 and raid4/5/6.
19
20Signed-off-by: NeilBrown <neilb@suse.de>
21---
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(-)
26
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)
30 return -EINVAL;
31 }
32 /*
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
35 */
36 if ( (1 << ffz(~chunk_size)) != chunk_size) {
37 printk(KERN_ERR "chunk_size of %d not valid\n", chunk_size);
38 return -EINVAL;
39 }
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);
44- return -EINVAL;
45- } else {
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);
48- }
49- }
50
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)
56 int nc, fc, fo;
57 sector_t stride, size;
58
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);
64 return -EINVAL;
65 }
66
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)
70 return -EIO;
71 }
72
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);
77+ return -EINVAL;
78+ }
79+
80 if (mddev->reshape_position != MaxSector) {
81 /* Check that we can continue the reshape.
82 * Currently only disks can change, it must