diff options
author | NeilBrown <neilb@suse.de> | 2010-05-21 18:31:36 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-05-21 18:31:36 -0400 |
commit | 19fdb9eefb21b72edbc365b838502780c392bad6 (patch) | |
tree | deae04c48532d6eab64ed4b0396737bb854b5506 /drivers/md | |
parent | be6800a73aa2f3dc14744c3b80e676d189789f04 (diff) | |
parent | 3ff195b011d7decf501a4d55aeed312731094796 (diff) |
Merge commit '3ff195b011d7decf501a4d55aeed312731094796' into for-linus
Conflicts:
drivers/md/md.c
- Resolved conflict in md_update_sb
- Added extra 'NULL' arg to new instance of sysfs_get_dirent.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bitmap.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-log-userspace-base.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-log-userspace-transfer.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-region-hash.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-service-time.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-sysfs.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-target.c | 1 | ||||
-rw-r--r-- | drivers/md/faulty.c | 1 | ||||
-rw-r--r-- | drivers/md/linear.c | 1 | ||||
-rw-r--r-- | drivers/md/md.c | 13 | ||||
-rw-r--r-- | drivers/md/multipath.c | 1 | ||||
-rw-r--r-- | drivers/md/raid0.c | 1 | ||||
-rw-r--r-- | drivers/md/raid1.c | 1 | ||||
-rw-r--r-- | drivers/md/raid10.c | 1 | ||||
-rw-r--r-- | drivers/md/raid5.c | 53 | ||||
-rw-r--r-- | drivers/md/raid6algos.c | 1 |
16 files changed, 47 insertions, 38 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index c9c6a345e17b..23d1d54b12a4 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1685,9 +1685,9 @@ int bitmap_create(mddev_t *mddev) | |||
1685 | 1685 | ||
1686 | bitmap->mddev = mddev; | 1686 | bitmap->mddev = mddev; |
1687 | 1687 | ||
1688 | bm = sysfs_get_dirent(mddev->kobj.sd, "bitmap"); | 1688 | bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap"); |
1689 | if (bm) { | 1689 | if (bm) { |
1690 | bitmap->sysfs_can_clear = sysfs_get_dirent(bm, "can_clear"); | 1690 | bitmap->sysfs_can_clear = sysfs_get_dirent(bm, NULL, "can_clear"); |
1691 | sysfs_put(bm); | 1691 | sysfs_put(bm); |
1692 | } else | 1692 | } else |
1693 | bitmap->sysfs_can_clear = NULL; | 1693 | bitmap->sysfs_can_clear = NULL; |
diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c index 7ac2c1450d10..1ed0094f064b 100644 --- a/drivers/md/dm-log-userspace-base.c +++ b/drivers/md/dm-log-userspace-base.c | |||
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/bio.h> | 7 | #include <linux/bio.h> |
8 | #include <linux/slab.h> | ||
8 | #include <linux/dm-dirty-log.h> | 9 | #include <linux/dm-dirty-log.h> |
9 | #include <linux/device-mapper.h> | 10 | #include <linux/device-mapper.h> |
10 | #include <linux/dm-log-userspace.h> | 11 | #include <linux/dm-log-userspace.h> |
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c index f1c8cae70b4b..075cbcf8a9f5 100644 --- a/drivers/md/dm-log-userspace-transfer.c +++ b/drivers/md/dm-log-userspace-transfer.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/slab.h> | ||
9 | #include <net/sock.h> | 10 | #include <net/sock.h> |
10 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
11 | #include <linux/connector.h> | 12 | #include <linux/connector.h> |
diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c index 168bd38f5006..bd5c58b28868 100644 --- a/drivers/md/dm-region-hash.c +++ b/drivers/md/dm-region-hash.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/ctype.h> | 11 | #include <linux/ctype.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
15 | 16 | ||
16 | #include "dm.h" | 17 | #include "dm.h" |
diff --git a/drivers/md/dm-service-time.c b/drivers/md/dm-service-time.c index cfa668f46c40..9c6c2e47ad62 100644 --- a/drivers/md/dm-service-time.c +++ b/drivers/md/dm-service-time.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include "dm.h" | 11 | #include "dm.h" |
12 | #include "dm-path-selector.h" | 12 | #include "dm-path-selector.h" |
13 | 13 | ||
14 | #include <linux/slab.h> | ||
15 | |||
14 | #define DM_MSG_PREFIX "multipath service-time" | 16 | #define DM_MSG_PREFIX "multipath service-time" |
15 | #define ST_MIN_IO 1 | 17 | #define ST_MIN_IO 1 |
16 | #define ST_MAX_RELATIVE_THROUGHPUT 100 | 18 | #define ST_MAX_RELATIVE_THROUGHPUT 100 |
diff --git a/drivers/md/dm-sysfs.c b/drivers/md/dm-sysfs.c index f91b40942e07..84d2b91e4efb 100644 --- a/drivers/md/dm-sysfs.c +++ b/drivers/md/dm-sysfs.c | |||
@@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = { | |||
75 | NULL, | 75 | NULL, |
76 | }; | 76 | }; |
77 | 77 | ||
78 | static struct sysfs_ops dm_sysfs_ops = { | 78 | static const struct sysfs_ops dm_sysfs_ops = { |
79 | .show = dm_attr_show, | 79 | .show = dm_attr_show, |
80 | }; | 80 | }; |
81 | 81 | ||
diff --git a/drivers/md/dm-target.c b/drivers/md/dm-target.c index 04feccf2a997..11dea11dc0b6 100644 --- a/drivers/md/dm-target.c +++ b/drivers/md/dm-target.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/kmod.h> | 11 | #include <linux/kmod.h> |
12 | #include <linux/bio.h> | 12 | #include <linux/bio.h> |
13 | #include <linux/slab.h> | ||
14 | 13 | ||
15 | #define DM_MSG_PREFIX "target" | 14 | #define DM_MSG_PREFIX "target" |
16 | 15 | ||
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index bd4348f6be0b..1a8987884614 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #define MaxFault 50 | 64 | #define MaxFault 50 |
65 | #include <linux/blkdev.h> | 65 | #include <linux/blkdev.h> |
66 | #include <linux/raid/md_u.h> | 66 | #include <linux/raid/md_u.h> |
67 | #include <linux/slab.h> | ||
67 | #include "md.h" | 68 | #include "md.h" |
68 | #include <linux/seq_file.h> | 69 | #include <linux/seq_file.h> |
69 | 70 | ||
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index d5d5064c4a66..7e0e057db9a7 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/blkdev.h> | 19 | #include <linux/blkdev.h> |
20 | #include <linux/raid/md_u.h> | 20 | #include <linux/raid/md_u.h> |
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/slab.h> | ||
22 | #include "md.h" | 23 | #include "md.h" |
23 | #include "linear.h" | 24 | #include "linear.h" |
24 | 25 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 26b3d2879d93..46b3a044eadf 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/delay.h> | 49 | #include <linux/delay.h> |
50 | #include <linux/raid/md_p.h> | 50 | #include <linux/raid/md_p.h> |
51 | #include <linux/raid/md_u.h> | 51 | #include <linux/raid/md_u.h> |
52 | #include <linux/slab.h> | ||
52 | #include "md.h" | 53 | #include "md.h" |
53 | #include "bitmap.h" | 54 | #include "bitmap.h" |
54 | 55 | ||
@@ -1814,7 +1815,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1814 | kobject_del(&rdev->kobj); | 1815 | kobject_del(&rdev->kobj); |
1815 | goto fail; | 1816 | goto fail; |
1816 | } | 1817 | } |
1817 | rdev->sysfs_state = sysfs_get_dirent(rdev->kobj.sd, "state"); | 1818 | rdev->sysfs_state = sysfs_get_dirent(rdev->kobj.sd, NULL, "state"); |
1818 | 1819 | ||
1819 | list_add_rcu(&rdev->same_set, &mddev->disks); | 1820 | list_add_rcu(&rdev->same_set, &mddev->disks); |
1820 | bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); | 1821 | bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); |
@@ -2683,7 +2684,7 @@ static void rdev_free(struct kobject *ko) | |||
2683 | mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj); | 2684 | mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj); |
2684 | kfree(rdev); | 2685 | kfree(rdev); |
2685 | } | 2686 | } |
2686 | static struct sysfs_ops rdev_sysfs_ops = { | 2687 | static const struct sysfs_ops rdev_sysfs_ops = { |
2687 | .show = rdev_attr_show, | 2688 | .show = rdev_attr_show, |
2688 | .store = rdev_attr_store, | 2689 | .store = rdev_attr_store, |
2689 | }; | 2690 | }; |
@@ -3027,7 +3028,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
3027 | printk(KERN_WARNING | 3028 | printk(KERN_WARNING |
3028 | "md: cannot register extra attributes for %s\n", | 3029 | "md: cannot register extra attributes for %s\n", |
3029 | mdname(mddev)); | 3030 | mdname(mddev)); |
3030 | mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action"); | 3031 | mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, NULL, "sync_action"); |
3031 | } | 3032 | } |
3032 | if (mddev->pers->sync_request != NULL && | 3033 | if (mddev->pers->sync_request != NULL && |
3033 | pers->sync_request == NULL) { | 3034 | pers->sync_request == NULL) { |
@@ -4146,7 +4147,7 @@ static void md_free(struct kobject *ko) | |||
4146 | kfree(mddev); | 4147 | kfree(mddev); |
4147 | } | 4148 | } |
4148 | 4149 | ||
4149 | static struct sysfs_ops md_sysfs_ops = { | 4150 | static const struct sysfs_ops md_sysfs_ops = { |
4150 | .show = md_attr_show, | 4151 | .show = md_attr_show, |
4151 | .store = md_attr_store, | 4152 | .store = md_attr_store, |
4152 | }; | 4153 | }; |
@@ -4260,7 +4261,7 @@ static int md_alloc(dev_t dev, char *name) | |||
4260 | mutex_unlock(&disks_mutex); | 4261 | mutex_unlock(&disks_mutex); |
4261 | if (!error) { | 4262 | if (!error) { |
4262 | kobject_uevent(&mddev->kobj, KOBJ_ADD); | 4263 | kobject_uevent(&mddev->kobj, KOBJ_ADD); |
4263 | mddev->sysfs_state = sysfs_get_dirent(mddev->kobj.sd, "array_state"); | 4264 | mddev->sysfs_state = sysfs_get_dirent(mddev->kobj.sd, NULL, "array_state"); |
4264 | } | 4265 | } |
4265 | mddev_put(mddev); | 4266 | mddev_put(mddev); |
4266 | return error; | 4267 | return error; |
@@ -4473,7 +4474,7 @@ static int md_run(mddev_t *mddev) | |||
4473 | printk(KERN_WARNING | 4474 | printk(KERN_WARNING |
4474 | "md: cannot register extra attributes for %s\n", | 4475 | "md: cannot register extra attributes for %s\n", |
4475 | mdname(mddev)); | 4476 | mdname(mddev)); |
4476 | mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action"); | 4477 | mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, NULL, "sync_action"); |
4477 | } else if (mddev->ro == 2) /* auto-readonly not meaningful */ | 4478 | } else if (mddev->ro == 2) /* auto-readonly not meaningful */ |
4478 | mddev->ro = 0; | 4479 | mddev->ro = 0; |
4479 | 4480 | ||
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 50bf8e6f8c7b..410fb60699ac 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
23 | #include <linux/raid/md_u.h> | 23 | #include <linux/raid/md_u.h> |
24 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
25 | #include <linux/slab.h> | ||
25 | #include "md.h" | 26 | #include "md.h" |
26 | #include "multipath.h" | 27 | #include "multipath.h" |
27 | 28 | ||
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index dc38c1a45166..e70f004c99e8 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/blkdev.h> | 21 | #include <linux/blkdev.h> |
22 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
23 | #include <linux/slab.h> | ||
23 | #include "md.h" | 24 | #include "md.h" |
24 | #include "raid0.h" | 25 | #include "raid0.h" |
25 | #include "raid5.h" | 26 | #include "raid5.h" |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a9b9972ff703..a948da8012de 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -31,6 +31,7 @@ | |||
31 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 31 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/slab.h> | ||
34 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
35 | #include <linux/blkdev.h> | 36 | #include <linux/blkdev.h> |
36 | #include <linux/seq_file.h> | 37 | #include <linux/seq_file.h> |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index a1f5fd2d69ce..03724992cdf2 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/slab.h> | ||
21 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
22 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
23 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index eacf02a6ec5f..9ea17d6c799b 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/async.h> | 50 | #include <linux/async.h> |
51 | #include <linux/seq_file.h> | 51 | #include <linux/seq_file.h> |
52 | #include <linux/cpu.h> | 52 | #include <linux/cpu.h> |
53 | #include <linux/slab.h> | ||
53 | #include "md.h" | 54 | #include "md.h" |
54 | #include "raid5.h" | 55 | #include "raid5.h" |
55 | #include "raid0.h" | 56 | #include "raid0.h" |
@@ -1654,8 +1655,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1654 | int previous, int *dd_idx, | 1655 | int previous, int *dd_idx, |
1655 | struct stripe_head *sh) | 1656 | struct stripe_head *sh) |
1656 | { | 1657 | { |
1657 | long stripe; | 1658 | sector_t stripe, stripe2; |
1658 | unsigned long chunk_number; | 1659 | sector_t chunk_number; |
1659 | unsigned int chunk_offset; | 1660 | unsigned int chunk_offset; |
1660 | int pd_idx, qd_idx; | 1661 | int pd_idx, qd_idx; |
1661 | int ddf_layout = 0; | 1662 | int ddf_layout = 0; |
@@ -1675,18 +1676,13 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1675 | */ | 1676 | */ |
1676 | chunk_offset = sector_div(r_sector, sectors_per_chunk); | 1677 | chunk_offset = sector_div(r_sector, sectors_per_chunk); |
1677 | chunk_number = r_sector; | 1678 | chunk_number = r_sector; |
1678 | BUG_ON(r_sector != chunk_number); | ||
1679 | 1679 | ||
1680 | /* | 1680 | /* |
1681 | * Compute the stripe number | 1681 | * Compute the stripe number |
1682 | */ | 1682 | */ |
1683 | stripe = chunk_number / data_disks; | 1683 | stripe = chunk_number; |
1684 | 1684 | *dd_idx = sector_div(stripe, data_disks); | |
1685 | /* | 1685 | stripe2 = stripe; |
1686 | * Compute the data disk and parity disk indexes inside the stripe | ||
1687 | */ | ||
1688 | *dd_idx = chunk_number % data_disks; | ||
1689 | |||
1690 | /* | 1686 | /* |
1691 | * Select the parity disk based on the user selected algorithm. | 1687 | * Select the parity disk based on the user selected algorithm. |
1692 | */ | 1688 | */ |
@@ -1698,21 +1694,21 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1698 | case 5: | 1694 | case 5: |
1699 | switch (algorithm) { | 1695 | switch (algorithm) { |
1700 | case ALGORITHM_LEFT_ASYMMETRIC: | 1696 | case ALGORITHM_LEFT_ASYMMETRIC: |
1701 | pd_idx = data_disks - stripe % raid_disks; | 1697 | pd_idx = data_disks - sector_div(stripe2, raid_disks); |
1702 | if (*dd_idx >= pd_idx) | 1698 | if (*dd_idx >= pd_idx) |
1703 | (*dd_idx)++; | 1699 | (*dd_idx)++; |
1704 | break; | 1700 | break; |
1705 | case ALGORITHM_RIGHT_ASYMMETRIC: | 1701 | case ALGORITHM_RIGHT_ASYMMETRIC: |
1706 | pd_idx = stripe % raid_disks; | 1702 | pd_idx = sector_div(stripe2, raid_disks); |
1707 | if (*dd_idx >= pd_idx) | 1703 | if (*dd_idx >= pd_idx) |
1708 | (*dd_idx)++; | 1704 | (*dd_idx)++; |
1709 | break; | 1705 | break; |
1710 | case ALGORITHM_LEFT_SYMMETRIC: | 1706 | case ALGORITHM_LEFT_SYMMETRIC: |
1711 | pd_idx = data_disks - stripe % raid_disks; | 1707 | pd_idx = data_disks - sector_div(stripe2, raid_disks); |
1712 | *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; | 1708 | *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; |
1713 | break; | 1709 | break; |
1714 | case ALGORITHM_RIGHT_SYMMETRIC: | 1710 | case ALGORITHM_RIGHT_SYMMETRIC: |
1715 | pd_idx = stripe % raid_disks; | 1711 | pd_idx = sector_div(stripe2, raid_disks); |
1716 | *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; | 1712 | *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; |
1717 | break; | 1713 | break; |
1718 | case ALGORITHM_PARITY_0: | 1714 | case ALGORITHM_PARITY_0: |
@@ -1730,7 +1726,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1730 | 1726 | ||
1731 | switch (algorithm) { | 1727 | switch (algorithm) { |
1732 | case ALGORITHM_LEFT_ASYMMETRIC: | 1728 | case ALGORITHM_LEFT_ASYMMETRIC: |
1733 | pd_idx = raid_disks - 1 - (stripe % raid_disks); | 1729 | pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks); |
1734 | qd_idx = pd_idx + 1; | 1730 | qd_idx = pd_idx + 1; |
1735 | if (pd_idx == raid_disks-1) { | 1731 | if (pd_idx == raid_disks-1) { |
1736 | (*dd_idx)++; /* Q D D D P */ | 1732 | (*dd_idx)++; /* Q D D D P */ |
@@ -1739,7 +1735,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1739 | (*dd_idx) += 2; /* D D P Q D */ | 1735 | (*dd_idx) += 2; /* D D P Q D */ |
1740 | break; | 1736 | break; |
1741 | case ALGORITHM_RIGHT_ASYMMETRIC: | 1737 | case ALGORITHM_RIGHT_ASYMMETRIC: |
1742 | pd_idx = stripe % raid_disks; | 1738 | pd_idx = sector_div(stripe2, raid_disks); |
1743 | qd_idx = pd_idx + 1; | 1739 | qd_idx = pd_idx + 1; |
1744 | if (pd_idx == raid_disks-1) { | 1740 | if (pd_idx == raid_disks-1) { |
1745 | (*dd_idx)++; /* Q D D D P */ | 1741 | (*dd_idx)++; /* Q D D D P */ |
@@ -1748,12 +1744,12 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1748 | (*dd_idx) += 2; /* D D P Q D */ | 1744 | (*dd_idx) += 2; /* D D P Q D */ |
1749 | break; | 1745 | break; |
1750 | case ALGORITHM_LEFT_SYMMETRIC: | 1746 | case ALGORITHM_LEFT_SYMMETRIC: |
1751 | pd_idx = raid_disks - 1 - (stripe % raid_disks); | 1747 | pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks); |
1752 | qd_idx = (pd_idx + 1) % raid_disks; | 1748 | qd_idx = (pd_idx + 1) % raid_disks; |
1753 | *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks; | 1749 | *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks; |
1754 | break; | 1750 | break; |
1755 | case ALGORITHM_RIGHT_SYMMETRIC: | 1751 | case ALGORITHM_RIGHT_SYMMETRIC: |
1756 | pd_idx = stripe % raid_disks; | 1752 | pd_idx = sector_div(stripe2, raid_disks); |
1757 | qd_idx = (pd_idx + 1) % raid_disks; | 1753 | qd_idx = (pd_idx + 1) % raid_disks; |
1758 | *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks; | 1754 | *dd_idx = (pd_idx + 2 + *dd_idx) % raid_disks; |
1759 | break; | 1755 | break; |
@@ -1772,7 +1768,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1772 | /* Exactly the same as RIGHT_ASYMMETRIC, but or | 1768 | /* Exactly the same as RIGHT_ASYMMETRIC, but or |
1773 | * of blocks for computing Q is different. | 1769 | * of blocks for computing Q is different. |
1774 | */ | 1770 | */ |
1775 | pd_idx = stripe % raid_disks; | 1771 | pd_idx = sector_div(stripe2, raid_disks); |
1776 | qd_idx = pd_idx + 1; | 1772 | qd_idx = pd_idx + 1; |
1777 | if (pd_idx == raid_disks-1) { | 1773 | if (pd_idx == raid_disks-1) { |
1778 | (*dd_idx)++; /* Q D D D P */ | 1774 | (*dd_idx)++; /* Q D D D P */ |
@@ -1787,7 +1783,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1787 | * D D D P Q rather than | 1783 | * D D D P Q rather than |
1788 | * Q D D D P | 1784 | * Q D D D P |
1789 | */ | 1785 | */ |
1790 | pd_idx = raid_disks - 1 - ((stripe + 1) % raid_disks); | 1786 | stripe2 += 1; |
1787 | pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks); | ||
1791 | qd_idx = pd_idx + 1; | 1788 | qd_idx = pd_idx + 1; |
1792 | if (pd_idx == raid_disks-1) { | 1789 | if (pd_idx == raid_disks-1) { |
1793 | (*dd_idx)++; /* Q D D D P */ | 1790 | (*dd_idx)++; /* Q D D D P */ |
@@ -1799,7 +1796,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1799 | 1796 | ||
1800 | case ALGORITHM_ROTATING_N_CONTINUE: | 1797 | case ALGORITHM_ROTATING_N_CONTINUE: |
1801 | /* Same as left_symmetric but Q is before P */ | 1798 | /* Same as left_symmetric but Q is before P */ |
1802 | pd_idx = raid_disks - 1 - (stripe % raid_disks); | 1799 | pd_idx = raid_disks - 1 - sector_div(stripe2, raid_disks); |
1803 | qd_idx = (pd_idx + raid_disks - 1) % raid_disks; | 1800 | qd_idx = (pd_idx + raid_disks - 1) % raid_disks; |
1804 | *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; | 1801 | *dd_idx = (pd_idx + 1 + *dd_idx) % raid_disks; |
1805 | ddf_layout = 1; | 1802 | ddf_layout = 1; |
@@ -1807,27 +1804,27 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, | |||
1807 | 1804 | ||
1808 | case ALGORITHM_LEFT_ASYMMETRIC_6: | 1805 | case ALGORITHM_LEFT_ASYMMETRIC_6: |
1809 | /* RAID5 left_asymmetric, with Q on last device */ | 1806 | /* RAID5 left_asymmetric, with Q on last device */ |
1810 | pd_idx = data_disks - stripe % (raid_disks-1); | 1807 | pd_idx = data_disks - sector_div(stripe2, raid_disks-1); |
1811 | if (*dd_idx >= pd_idx) | 1808 | if (*dd_idx >= pd_idx) |
1812 | (*dd_idx)++; | 1809 | (*dd_idx)++; |
1813 | qd_idx = raid_disks - 1; | 1810 | qd_idx = raid_disks - 1; |
1814 | break; | 1811 | break; |
1815 | 1812 | ||
1816 | case ALGORITHM_RIGHT_ASYMMETRIC_6: | 1813 | case ALGORITHM_RIGHT_ASYMMETRIC_6: |
1817 | pd_idx = stripe % (raid_disks-1); | 1814 | pd_idx = sector_div(stripe2, raid_disks-1); |
1818 | if (*dd_idx >= pd_idx) | 1815 | if (*dd_idx >= pd_idx) |
1819 | (*dd_idx)++; | 1816 | (*dd_idx)++; |
1820 | qd_idx = raid_disks - 1; | 1817 | qd_idx = raid_disks - 1; |
1821 | break; | 1818 | break; |
1822 | 1819 | ||
1823 | case ALGORITHM_LEFT_SYMMETRIC_6: | 1820 | case ALGORITHM_LEFT_SYMMETRIC_6: |
1824 | pd_idx = data_disks - stripe % (raid_disks-1); | 1821 | pd_idx = data_disks - sector_div(stripe2, raid_disks-1); |
1825 | *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1); | 1822 | *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1); |
1826 | qd_idx = raid_disks - 1; | 1823 | qd_idx = raid_disks - 1; |
1827 | break; | 1824 | break; |
1828 | 1825 | ||
1829 | case ALGORITHM_RIGHT_SYMMETRIC_6: | 1826 | case ALGORITHM_RIGHT_SYMMETRIC_6: |
1830 | pd_idx = stripe % (raid_disks-1); | 1827 | pd_idx = sector_div(stripe2, raid_disks-1); |
1831 | *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1); | 1828 | *dd_idx = (pd_idx + 1 + *dd_idx) % (raid_disks-1); |
1832 | qd_idx = raid_disks - 1; | 1829 | qd_idx = raid_disks - 1; |
1833 | break; | 1830 | break; |
@@ -1869,14 +1866,14 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous) | |||
1869 | : conf->algorithm; | 1866 | : conf->algorithm; |
1870 | sector_t stripe; | 1867 | sector_t stripe; |
1871 | int chunk_offset; | 1868 | int chunk_offset; |
1872 | int chunk_number, dummy1, dd_idx = i; | 1869 | sector_t chunk_number; |
1870 | int dummy1, dd_idx = i; | ||
1873 | sector_t r_sector; | 1871 | sector_t r_sector; |
1874 | struct stripe_head sh2; | 1872 | struct stripe_head sh2; |
1875 | 1873 | ||
1876 | 1874 | ||
1877 | chunk_offset = sector_div(new_sector, sectors_per_chunk); | 1875 | chunk_offset = sector_div(new_sector, sectors_per_chunk); |
1878 | stripe = new_sector; | 1876 | stripe = new_sector; |
1879 | BUG_ON(new_sector != stripe); | ||
1880 | 1877 | ||
1881 | if (i == sh->pd_idx) | 1878 | if (i == sh->pd_idx) |
1882 | return 0; | 1879 | return 0; |
@@ -1965,7 +1962,7 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous) | |||
1965 | } | 1962 | } |
1966 | 1963 | ||
1967 | chunk_number = stripe * data_disks + i; | 1964 | chunk_number = stripe * data_disks + i; |
1968 | r_sector = (sector_t)chunk_number * sectors_per_chunk + chunk_offset; | 1965 | r_sector = chunk_number * sectors_per_chunk + chunk_offset; |
1969 | 1966 | ||
1970 | check = raid5_compute_sector(conf, r_sector, | 1967 | check = raid5_compute_sector(conf, r_sector, |
1971 | previous, &dummy1, &sh2); | 1968 | previous, &dummy1, &sh2); |
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c index bffc61bff5ab..1f8784bfd44d 100644 --- a/drivers/md/raid6algos.c +++ b/drivers/md/raid6algos.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/raid/pq.h> | 19 | #include <linux/raid/pq.h> |
20 | #include <linux/gfp.h> | ||
20 | #ifndef __KERNEL__ | 21 | #ifndef __KERNEL__ |
21 | #include <sys/mman.h> | 22 | #include <sys/mman.h> |
22 | #include <stdio.h> | 23 | #include <stdio.h> |