Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | raid0.c : Multiple Devices driver for Linux |
| 3 | Copyright (C) 1994-96 Marc ZYNGIER |
| 4 | <zyngier@ufr-info-p7.ibp.fr> or |
| 5 | <maz@gloups.fdn.fr> |
| 6 | Copyright (C) 1999, 2000 Ingo Molnar, Red Hat |
| 7 | |
| 8 | |
| 9 | RAID-0 management functions. |
| 10 | |
| 11 | This program is free software; you can redistribute it and/or modify |
| 12 | it under the terms of the GNU General Public License as published by |
| 13 | the Free Software Foundation; either version 2, or (at your option) |
| 14 | any later version. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | (for example /usr/src/linux/COPYING); if not, write to the Free |
| 18 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ |
| 20 | |
NeilBrown | bff6197 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 21 | #include <linux/blkdev.h> |
NeilBrown | bff6197 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 22 | #include <linux/seq_file.h> |
NeilBrown | 43b2e5d | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 23 | #include "md.h" |
Christoph Hellwig | ef740c3 | 2009-03-31 14:27:03 +1100 | [diff] [blame] | 24 | #include "raid0.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Jens Axboe | 165125e | 2007-07-24 09:28:11 +0200 | [diff] [blame] | 26 | static void raid0_unplug(struct request_queue *q) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | { |
| 28 | mddev_t *mddev = q->queuedata; |
NeilBrown | 070ec55 | 2009-06-16 16:54:21 +1000 | [diff] [blame] | 29 | raid0_conf_t *conf = mddev->private; |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 30 | mdk_rdev_t **devlist = conf->devlist; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | int i; |
| 32 | |
| 33 | for (i=0; i<mddev->raid_disks; i++) { |
Jens Axboe | 165125e | 2007-07-24 09:28:11 +0200 | [diff] [blame] | 34 | struct request_queue *r_queue = bdev_get_queue(devlist[i]->bdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Alan D. Brunelle | 2ad8b1e | 2007-11-07 14:26:56 -0500 | [diff] [blame] | 36 | blk_unplug(r_queue); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | } |
| 38 | } |
| 39 | |
NeilBrown | 26be34d | 2006-10-03 01:15:53 -0700 | [diff] [blame] | 40 | static int raid0_congested(void *data, int bits) |
| 41 | { |
| 42 | mddev_t *mddev = data; |
NeilBrown | 070ec55 | 2009-06-16 16:54:21 +1000 | [diff] [blame] | 43 | raid0_conf_t *conf = mddev->private; |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 44 | mdk_rdev_t **devlist = conf->devlist; |
NeilBrown | 26be34d | 2006-10-03 01:15:53 -0700 | [diff] [blame] | 45 | int i, ret = 0; |
| 46 | |
| 47 | for (i = 0; i < mddev->raid_disks && !ret ; i++) { |
Jens Axboe | 165125e | 2007-07-24 09:28:11 +0200 | [diff] [blame] | 48 | struct request_queue *q = bdev_get_queue(devlist[i]->bdev); |
NeilBrown | 26be34d | 2006-10-03 01:15:53 -0700 | [diff] [blame] | 49 | |
| 50 | ret |= bdi_congested(&q->backing_dev_info, bits); |
| 51 | } |
| 52 | return ret; |
| 53 | } |
| 54 | |
raz ben yehuda | 4699419 | 2009-06-16 17:00:54 +1000 | [diff] [blame] | 55 | /* |
| 56 | * inform the user of the raid configuration |
| 57 | */ |
| 58 | static void dump_zones(mddev_t *mddev) |
| 59 | { |
| 60 | int j, k, h; |
| 61 | sector_t zone_size = 0; |
| 62 | sector_t zone_start = 0; |
| 63 | char b[BDEVNAME_SIZE]; |
| 64 | raid0_conf_t *conf = mddev->private; |
| 65 | printk(KERN_INFO "******* %s configuration *********\n", |
| 66 | mdname(mddev)); |
| 67 | h = 0; |
| 68 | for (j = 0; j < conf->nr_strip_zones; j++) { |
| 69 | printk(KERN_INFO "zone%d=[", j); |
| 70 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) |
| 71 | printk("%s/", |
| 72 | bdevname(conf->devlist[j*mddev->raid_disks |
| 73 | + k]->bdev, b)); |
| 74 | printk("]\n"); |
| 75 | |
| 76 | zone_size = conf->strip_zone[j].zone_end - zone_start; |
| 77 | printk(KERN_INFO " zone offset=%llukb " |
| 78 | "device offset=%llukb size=%llukb\n", |
| 79 | (unsigned long long)zone_start>>1, |
| 80 | (unsigned long long)conf->strip_zone[j].dev_start>>1, |
| 81 | (unsigned long long)zone_size>>1); |
| 82 | zone_start = conf->strip_zone[j].zone_end; |
| 83 | } |
| 84 | printk(KERN_INFO "**********************************\n\n"); |
| 85 | } |
| 86 | |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 87 | static int create_strip_zones(mddev_t *mddev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | { |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 89 | int i, c, j, err; |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 90 | sector_t curr_zone_end, sectors; |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 91 | mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev, **dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | struct strip_zone *zone; |
| 93 | int cnt; |
| 94 | char b[BDEVNAME_SIZE]; |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 95 | raid0_conf_t *conf = kzalloc(sizeof(*conf), GFP_KERNEL); |
| 96 | |
| 97 | if (!conf) |
| 98 | return -ENOMEM; |
Cheng Renquan | 159ec1f | 2009-01-09 08:31:08 +1100 | [diff] [blame] | 99 | list_for_each_entry(rdev1, &mddev->disks, same_set) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 100 | printk(KERN_INFO "raid0: looking at %s\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | bdevname(rdev1->bdev,b)); |
| 102 | c = 0; |
NeilBrown | 13f2682 | 2009-06-18 08:48:55 +1000 | [diff] [blame] | 103 | |
| 104 | /* round size to chunk_size */ |
| 105 | sectors = rdev1->sectors; |
| 106 | sector_div(sectors, mddev->chunk_sectors); |
| 107 | rdev1->sectors = sectors * mddev->chunk_sectors; |
| 108 | |
Cheng Renquan | 159ec1f | 2009-01-09 08:31:08 +1100 | [diff] [blame] | 109 | list_for_each_entry(rdev2, &mddev->disks, same_set) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 110 | printk(KERN_INFO "raid0: comparing %s(%llu)", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | bdevname(rdev1->bdev,b), |
Andre Noll | dd8ac33 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 112 | (unsigned long long)rdev1->sectors); |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 113 | printk(KERN_INFO " with %s(%llu)\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | bdevname(rdev2->bdev,b), |
Andre Noll | dd8ac33 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 115 | (unsigned long long)rdev2->sectors); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | if (rdev2 == rdev1) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 117 | printk(KERN_INFO "raid0: END\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | break; |
| 119 | } |
Andre Noll | dd8ac33 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 120 | if (rdev2->sectors == rdev1->sectors) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | /* |
| 122 | * Not unique, don't count it as a new |
| 123 | * group |
| 124 | */ |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 125 | printk(KERN_INFO "raid0: EQUAL\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | c = 1; |
| 127 | break; |
| 128 | } |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 129 | printk(KERN_INFO "raid0: NOT EQUAL\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | } |
| 131 | if (!c) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 132 | printk(KERN_INFO "raid0: ==> UNIQUE\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | conf->nr_strip_zones++; |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 134 | printk(KERN_INFO "raid0: %d zones\n", |
| 135 | conf->nr_strip_zones); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | } |
| 137 | } |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 138 | printk(KERN_INFO "raid0: FINAL %d zones\n", conf->nr_strip_zones); |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 139 | err = -ENOMEM; |
NeilBrown | 9ffae0c | 2006-01-06 00:20:32 -0800 | [diff] [blame] | 140 | conf->strip_zone = kzalloc(sizeof(struct strip_zone)* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | conf->nr_strip_zones, GFP_KERNEL); |
| 142 | if (!conf->strip_zone) |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 143 | goto abort; |
NeilBrown | 9ffae0c | 2006-01-06 00:20:32 -0800 | [diff] [blame] | 144 | conf->devlist = kzalloc(sizeof(mdk_rdev_t*)* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | conf->nr_strip_zones*mddev->raid_disks, |
| 146 | GFP_KERNEL); |
| 147 | if (!conf->devlist) |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 148 | goto abort; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | /* The first zone must contain all devices, so here we check that |
| 151 | * there is a proper alignment of slots to devices and find them all |
| 152 | */ |
| 153 | zone = &conf->strip_zone[0]; |
| 154 | cnt = 0; |
| 155 | smallest = NULL; |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 156 | dev = conf->devlist; |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 157 | err = -EINVAL; |
Cheng Renquan | 159ec1f | 2009-01-09 08:31:08 +1100 | [diff] [blame] | 158 | list_for_each_entry(rdev1, &mddev->disks, same_set) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | int j = rdev1->raid_disk; |
| 160 | |
| 161 | if (j < 0 || j >= mddev->raid_disks) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 162 | printk(KERN_ERR "raid0: bad disk number %d - " |
| 163 | "aborting!\n", j); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | goto abort; |
| 165 | } |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 166 | if (dev[j]) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 167 | printk(KERN_ERR "raid0: multiple devices for %d - " |
| 168 | "aborting!\n", j); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | goto abort; |
| 170 | } |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 171 | dev[j] = rdev1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | |
Martin K. Petersen | 8f6c2e4 | 2009-07-01 11:13:45 +1000 | [diff] [blame] | 173 | disk_stack_limits(mddev->gendisk, rdev1->bdev, |
| 174 | rdev1->data_offset << 9); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | /* as we don't honour merge_bvec_fn, we must never risk |
| 176 | * violating it, so limit ->max_sector to one PAGE, as |
| 177 | * a one page request is never in violation. |
| 178 | */ |
| 179 | |
| 180 | if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && |
Martin K. Petersen | ae03bf6 | 2009-05-22 17:17:50 -0400 | [diff] [blame] | 181 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); |
| 183 | |
Andre Noll | dd8ac33 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 184 | if (!smallest || (rdev1->sectors < smallest->sectors)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | smallest = rdev1; |
| 186 | cnt++; |
| 187 | } |
| 188 | if (cnt != mddev->raid_disks) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 189 | printk(KERN_ERR "raid0: too few disks (%d of %d) - " |
| 190 | "aborting!\n", cnt, mddev->raid_disks); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | goto abort; |
| 192 | } |
| 193 | zone->nb_dev = cnt; |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 194 | zone->zone_end = smallest->sectors * cnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 196 | curr_zone_end = zone->zone_end; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
| 198 | /* now do the other zones */ |
| 199 | for (i = 1; i < conf->nr_strip_zones; i++) |
| 200 | { |
| 201 | zone = conf->strip_zone + i; |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 202 | dev = conf->devlist + i * mddev->raid_disks; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 204 | printk(KERN_INFO "raid0: zone %d\n", i); |
NeilBrown | d27a43ab | 2009-06-16 16:46:46 +1000 | [diff] [blame] | 205 | zone->dev_start = smallest->sectors; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | smallest = NULL; |
| 207 | c = 0; |
| 208 | |
| 209 | for (j=0; j<cnt; j++) { |
| 210 | char b[BDEVNAME_SIZE]; |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 211 | rdev = conf->devlist[j]; |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 212 | printk(KERN_INFO "raid0: checking %s ...", |
| 213 | bdevname(rdev->bdev, b)); |
NeilBrown | d27a43ab | 2009-06-16 16:46:46 +1000 | [diff] [blame] | 214 | if (rdev->sectors <= zone->dev_start) { |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 215 | printk(KERN_INFO " nope.\n"); |
Andre Noll | dd8ac33 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 216 | continue; |
| 217 | } |
| 218 | printk(KERN_INFO " contained as device %d\n", c); |
NeilBrown | b414579 | 2009-06-16 16:50:52 +1000 | [diff] [blame] | 219 | dev[c] = rdev; |
Andre Noll | dd8ac33 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 220 | c++; |
| 221 | if (!smallest || rdev->sectors < smallest->sectors) { |
| 222 | smallest = rdev; |
| 223 | printk(KERN_INFO " (%llu) is smallest!.\n", |
| 224 | (unsigned long long)rdev->sectors); |
| 225 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | zone->nb_dev = c; |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 229 | sectors = (smallest->sectors - zone->dev_start) * c; |
Andre Noll | 83838ed | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 230 | printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n", |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 231 | zone->nb_dev, (unsigned long long)sectors); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 233 | curr_zone_end += sectors; |
NeilBrown | d27a43ab | 2009-06-16 16:46:46 +1000 | [diff] [blame] | 234 | zone->zone_end = curr_zone_end; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | |
Andre Noll | 6b8796c | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 236 | printk(KERN_INFO "raid0: current zone start: %llu\n", |
NeilBrown | d27a43ab | 2009-06-16 16:46:46 +1000 | [diff] [blame] | 237 | (unsigned long long)smallest->sectors); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | mddev->queue->unplug_fn = raid0_unplug; |
NeilBrown | 26be34d | 2006-10-03 01:15:53 -0700 | [diff] [blame] | 240 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; |
| 241 | mddev->queue->backing_dev_info.congested_data = mddev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
raz ben yehuda | 92e59b6 | 2009-06-16 17:00:57 +1000 | [diff] [blame] | 243 | /* |
| 244 | * now since we have the hard sector sizes, we can make sure |
| 245 | * chunk size is a multiple of that sector size |
| 246 | */ |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 247 | if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) { |
raz ben yehuda | 92e59b6 | 2009-06-16 17:00:57 +1000 | [diff] [blame] | 248 | printk(KERN_ERR "%s chunk_size of %d not valid\n", |
| 249 | mdname(mddev), |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 250 | mddev->chunk_sectors << 9); |
raz ben yehuda | 92e59b6 | 2009-06-16 17:00:57 +1000 | [diff] [blame] | 251 | goto abort; |
| 252 | } |
Martin K. Petersen | 8f6c2e4 | 2009-07-01 11:13:45 +1000 | [diff] [blame] | 253 | |
| 254 | blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9); |
| 255 | blk_queue_io_opt(mddev->queue, |
| 256 | (mddev->chunk_sectors << 9) * mddev->raid_disks); |
| 257 | |
Andre Noll | 0825b87a | 2009-01-09 08:31:07 +1100 | [diff] [blame] | 258 | printk(KERN_INFO "raid0: done.\n"); |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 259 | mddev->private = conf; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | return 0; |
Andre Noll | 5568a60 | 2009-06-16 16:47:21 +1000 | [diff] [blame] | 261 | abort: |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 262 | kfree(conf->strip_zone); |
| 263 | kfree(conf->devlist); |
| 264 | kfree(conf); |
| 265 | mddev->private = NULL; |
| 266 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | /** |
| 270 | * raid0_mergeable_bvec -- tell bio layer if a two requests can be merged |
| 271 | * @q: request queue |
Alasdair G Kergon | cc371e6 | 2008-07-03 09:53:43 +0200 | [diff] [blame] | 272 | * @bvm: properties of new bio |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | * @biovec: the request that could be merged to it. |
| 274 | * |
| 275 | * Return amount of bytes we can accept at this offset |
| 276 | */ |
Alasdair G Kergon | cc371e6 | 2008-07-03 09:53:43 +0200 | [diff] [blame] | 277 | static int raid0_mergeable_bvec(struct request_queue *q, |
| 278 | struct bvec_merge_data *bvm, |
| 279 | struct bio_vec *biovec) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | { |
| 281 | mddev_t *mddev = q->queuedata; |
Alasdair G Kergon | cc371e6 | 2008-07-03 09:53:43 +0200 | [diff] [blame] | 282 | sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | int max; |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 284 | unsigned int chunk_sectors = mddev->chunk_sectors; |
Alasdair G Kergon | cc371e6 | 2008-07-03 09:53:43 +0200 | [diff] [blame] | 285 | unsigned int bio_sectors = bvm->bi_size >> 9; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | |
NeilBrown | d6e412e | 2009-06-18 08:47:00 +1000 | [diff] [blame] | 287 | if (is_power_of_2(chunk_sectors)) |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 288 | max = (chunk_sectors - ((sector & (chunk_sectors-1)) |
| 289 | + bio_sectors)) << 9; |
| 290 | else |
| 291 | max = (chunk_sectors - (sector_div(sector, chunk_sectors) |
| 292 | + bio_sectors)) << 9; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | if (max < 0) max = 0; /* bio_add cannot handle a negative return */ |
| 294 | if (max <= biovec->bv_len && bio_sectors == 0) |
| 295 | return biovec->bv_len; |
| 296 | else |
| 297 | return max; |
| 298 | } |
| 299 | |
Dan Williams | 80c3a6c | 2009-03-17 18:10:40 -0700 | [diff] [blame] | 300 | static sector_t raid0_size(mddev_t *mddev, sector_t sectors, int raid_disks) |
| 301 | { |
| 302 | sector_t array_sectors = 0; |
| 303 | mdk_rdev_t *rdev; |
| 304 | |
| 305 | WARN_ONCE(sectors || raid_disks, |
| 306 | "%s does not support generic reshape\n", __func__); |
| 307 | |
| 308 | list_for_each_entry(rdev, &mddev->disks, same_set) |
| 309 | array_sectors += rdev->sectors; |
| 310 | |
| 311 | return array_sectors; |
| 312 | } |
| 313 | |
Andre Noll | 8f79cfc | 2009-06-16 16:47:10 +1000 | [diff] [blame] | 314 | static int raid0_run(mddev_t *mddev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | { |
Andre Noll | 5568a60 | 2009-06-16 16:47:21 +1000 | [diff] [blame] | 316 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 318 | if (mddev->chunk_sectors == 0) { |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 319 | printk(KERN_ERR "md/raid0: chunk size must be set.\n"); |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 320 | return -EINVAL; |
| 321 | } |
Andre Noll | 0894cc3 | 2009-06-18 08:49:23 +1000 | [diff] [blame] | 322 | if (md_check_no_bitmap(mddev)) |
| 323 | return -EINVAL; |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 324 | blk_queue_max_sectors(mddev->queue, mddev->chunk_sectors); |
Neil Brown | e7e72bf | 2008-05-14 16:05:54 -0700 | [diff] [blame] | 325 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Andre Noll | 5568a60 | 2009-06-16 16:47:21 +1000 | [diff] [blame] | 327 | ret = create_strip_zones(mddev); |
| 328 | if (ret < 0) |
Andre Noll | ed7b003 | 2009-06-16 16:47:36 +1000 | [diff] [blame] | 329 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | |
| 331 | /* calculate array device size */ |
Dan Williams | 1f40362 | 2009-03-31 14:59:03 +1100 | [diff] [blame] | 332 | md_set_array_sectors(mddev, raid0_size(mddev, 0, 0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | |
Andre Noll | ccacc7d | 2009-01-09 08:31:08 +1100 | [diff] [blame] | 334 | printk(KERN_INFO "raid0 : md_size is %llu sectors.\n", |
| 335 | (unsigned long long)mddev->array_sectors); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | /* calculate the max read-ahead size. |
| 337 | * For read-ahead of large files to be effective, we need to |
| 338 | * readahead at least twice a whole stripe. i.e. number of devices |
| 339 | * multiplied by chunk size times 2. |
| 340 | * If an individual device has an ra_pages greater than the |
| 341 | * chunk size, then we will not drive that device as hard as it |
| 342 | * wants. We consider this a configuration error: a larger |
| 343 | * chunksize should be used in that case. |
| 344 | */ |
| 345 | { |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 346 | int stripe = mddev->raid_disks * |
| 347 | (mddev->chunk_sectors << 9) / PAGE_SIZE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | if (mddev->queue->backing_dev_info.ra_pages < 2* stripe) |
| 349 | mddev->queue->backing_dev_info.ra_pages = 2* stripe; |
| 350 | } |
| 351 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | blk_queue_merge_bvec(mddev->queue, raid0_mergeable_bvec); |
raz ben yehuda | 4699419 | 2009-06-16 17:00:54 +1000 | [diff] [blame] | 353 | dump_zones(mddev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | } |
| 356 | |
Andre Noll | fb5ab4b | 2009-06-16 16:48:19 +1000 | [diff] [blame] | 357 | static int raid0_stop(mddev_t *mddev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | { |
NeilBrown | 070ec55 | 2009-06-16 16:54:21 +1000 | [diff] [blame] | 359 | raid0_conf_t *conf = mddev->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | |
| 361 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ |
Jesper Juhl | 990a8ba | 2005-06-21 17:17:30 -0700 | [diff] [blame] | 362 | kfree(conf->strip_zone); |
Andre Noll | fb5ab4b | 2009-06-16 16:48:19 +1000 | [diff] [blame] | 363 | kfree(conf->devlist); |
Jesper Juhl | 990a8ba | 2005-06-21 17:17:30 -0700 | [diff] [blame] | 364 | kfree(conf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | mddev->private = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | return 0; |
| 367 | } |
| 368 | |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 369 | /* Find the zone which holds a particular offset |
| 370 | * Update *sectorp to be an offset in that zone |
| 371 | */ |
Andre Noll | dc58266 | 2009-06-16 16:18:43 +1000 | [diff] [blame] | 372 | static struct strip_zone *find_zone(struct raid0_private_data *conf, |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 373 | sector_t *sectorp) |
Andre Noll | dc58266 | 2009-06-16 16:18:43 +1000 | [diff] [blame] | 374 | { |
| 375 | int i; |
| 376 | struct strip_zone *z = conf->strip_zone; |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 377 | sector_t sector = *sectorp; |
Andre Noll | dc58266 | 2009-06-16 16:18:43 +1000 | [diff] [blame] | 378 | |
| 379 | for (i = 0; i < conf->nr_strip_zones; i++) |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 380 | if (sector < z[i].zone_end) { |
| 381 | if (i) |
| 382 | *sectorp = sector - z[i-1].zone_end; |
Andre Noll | dc58266 | 2009-06-16 16:18:43 +1000 | [diff] [blame] | 383 | return z + i; |
NeilBrown | 49f357a2 | 2009-06-16 16:50:35 +1000 | [diff] [blame] | 384 | } |
Andre Noll | dc58266 | 2009-06-16 16:18:43 +1000 | [diff] [blame] | 385 | BUG(); |
| 386 | } |
| 387 | |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 388 | /* |
| 389 | * remaps the bio to the target device. we separate two flows. |
| 390 | * power 2 flow and a general flow for the sake of perfromance |
| 391 | */ |
| 392 | static mdk_rdev_t *map_sector(mddev_t *mddev, struct strip_zone *zone, |
| 393 | sector_t sector, sector_t *sector_offset) |
| 394 | { |
| 395 | unsigned int sect_in_chunk; |
| 396 | sector_t chunk; |
| 397 | raid0_conf_t *conf = mddev->private; |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 398 | unsigned int chunk_sects = mddev->chunk_sectors; |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 399 | |
NeilBrown | d6e412e | 2009-06-18 08:47:00 +1000 | [diff] [blame] | 400 | if (is_power_of_2(chunk_sects)) { |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 401 | int chunksect_bits = ffz(~chunk_sects); |
| 402 | /* find the sector offset inside the chunk */ |
| 403 | sect_in_chunk = sector & (chunk_sects - 1); |
| 404 | sector >>= chunksect_bits; |
| 405 | /* chunk in zone */ |
| 406 | chunk = *sector_offset; |
| 407 | /* quotient is the chunk in real device*/ |
| 408 | sector_div(chunk, zone->nb_dev << chunksect_bits); |
| 409 | } else{ |
| 410 | sect_in_chunk = sector_div(sector, chunk_sects); |
| 411 | chunk = *sector_offset; |
| 412 | sector_div(chunk, chunk_sects * zone->nb_dev); |
| 413 | } |
| 414 | /* |
| 415 | * position the bio over the real device |
| 416 | * real sector = chunk in device + starting of zone |
| 417 | * + the position in the chunk |
| 418 | */ |
| 419 | *sector_offset = (chunk * chunk_sects) + sect_in_chunk; |
| 420 | return conf->devlist[(zone - conf->strip_zone)*mddev->raid_disks |
| 421 | + sector_div(sector, zone->nb_dev)]; |
| 422 | } |
| 423 | |
| 424 | /* |
| 425 | * Is io distribute over 1 or more chunks ? |
| 426 | */ |
| 427 | static inline int is_io_in_chunk_boundary(mddev_t *mddev, |
| 428 | unsigned int chunk_sects, struct bio *bio) |
| 429 | { |
NeilBrown | d6e412e | 2009-06-18 08:47:00 +1000 | [diff] [blame] | 430 | if (likely(is_power_of_2(chunk_sects))) { |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 431 | return chunk_sects >= ((bio->bi_sector & (chunk_sects-1)) |
| 432 | + (bio->bi_size >> 9)); |
| 433 | } else{ |
| 434 | sector_t sector = bio->bi_sector; |
| 435 | return chunk_sects >= (sector_div(sector, chunk_sects) |
| 436 | + (bio->bi_size >> 9)); |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | static int raid0_make_request(struct request_queue *q, struct bio *bio) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | { |
| 442 | mddev_t *mddev = q->queuedata; |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 443 | unsigned int chunk_sects; |
| 444 | sector_t sector_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | struct strip_zone *zone; |
| 446 | mdk_rdev_t *tmp_dev; |
Jens Axboe | a362357 | 2005-11-01 09:26:16 +0100 | [diff] [blame] | 447 | const int rw = bio_data_dir(bio); |
Tejun Heo | c995905 | 2008-08-25 19:47:21 +0900 | [diff] [blame] | 448 | int cpu; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | |
NeilBrown | e5dcdd8 | 2005-09-09 16:23:41 -0700 | [diff] [blame] | 450 | if (unlikely(bio_barrier(bio))) { |
NeilBrown | 6712ecf | 2007-09-27 12:47:43 +0200 | [diff] [blame] | 451 | bio_endio(bio, -EOPNOTSUPP); |
NeilBrown | e5dcdd8 | 2005-09-09 16:23:41 -0700 | [diff] [blame] | 452 | return 0; |
| 453 | } |
| 454 | |
Tejun Heo | 074a7ac | 2008-08-25 19:56:14 +0900 | [diff] [blame] | 455 | cpu = part_stat_lock(); |
| 456 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); |
| 457 | part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], |
| 458 | bio_sectors(bio)); |
| 459 | part_stat_unlock(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 461 | chunk_sects = mddev->chunk_sectors; |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 462 | if (unlikely(!is_io_in_chunk_boundary(mddev, chunk_sects, bio))) { |
| 463 | sector_t sector = bio->bi_sector; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | struct bio_pair *bp; |
| 465 | /* Sanity check -- queue functions should prevent this happening */ |
| 466 | if (bio->bi_vcnt != 1 || |
| 467 | bio->bi_idx != 0) |
| 468 | goto bad_map; |
| 469 | /* This is a one page bio that upper layers |
| 470 | * refuse to split for us, so we need to split it. |
| 471 | */ |
NeilBrown | d6e412e | 2009-06-18 08:47:00 +1000 | [diff] [blame] | 472 | if (likely(is_power_of_2(chunk_sects))) |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 473 | bp = bio_split(bio, chunk_sects - (sector & |
| 474 | (chunk_sects-1))); |
| 475 | else |
| 476 | bp = bio_split(bio, chunk_sects - |
| 477 | sector_div(sector, chunk_sects)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | if (raid0_make_request(q, &bp->bio1)) |
| 479 | generic_make_request(&bp->bio1); |
| 480 | if (raid0_make_request(q, &bp->bio2)) |
| 481 | generic_make_request(&bp->bio2); |
| 482 | |
| 483 | bio_pair_release(bp); |
| 484 | return 0; |
| 485 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 487 | sector_offset = bio->bi_sector; |
| 488 | zone = find_zone(mddev->private, §or_offset); |
| 489 | tmp_dev = map_sector(mddev, zone, bio->bi_sector, |
| 490 | §or_offset); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | bio->bi_bdev = tmp_dev->bdev; |
raz ben yehuda | fbb704e | 2009-06-16 17:02:05 +1000 | [diff] [blame] | 492 | bio->bi_sector = sector_offset + zone->dev_start + |
| 493 | tmp_dev->data_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | /* |
| 495 | * Let the main block layer submit the IO and resolve recursion: |
| 496 | */ |
| 497 | return 1; |
| 498 | |
| 499 | bad_map: |
| 500 | printk("raid0_make_request bug: can't convert block across chunks" |
Andre Noll | a471200 | 2009-01-09 08:31:06 +1100 | [diff] [blame] | 501 | " or bigger than %dk %llu %d\n", chunk_sects / 2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | (unsigned long long)bio->bi_sector, bio->bi_size >> 10); |
| 503 | |
NeilBrown | 6712ecf | 2007-09-27 12:47:43 +0200 | [diff] [blame] | 504 | bio_io_error(bio); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | return 0; |
| 506 | } |
NeilBrown | 8299d7f | 2007-10-16 23:30:53 -0700 | [diff] [blame] | 507 | |
raz ben yehuda | 1b96142 | 2009-06-16 16:57:40 +1000 | [diff] [blame] | 508 | static void raid0_status(struct seq_file *seq, mddev_t *mddev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | { |
| 510 | #undef MD_DEBUG |
| 511 | #ifdef MD_DEBUG |
| 512 | int j, k, h; |
| 513 | char b[BDEVNAME_SIZE]; |
NeilBrown | 070ec55 | 2009-06-16 16:54:21 +1000 | [diff] [blame] | 514 | raid0_conf_t *conf = mddev->private; |
NeilBrown | 8299d7f | 2007-10-16 23:30:53 -0700 | [diff] [blame] | 515 | |
raz ben yehuda | 1b96142 | 2009-06-16 16:57:40 +1000 | [diff] [blame] | 516 | sector_t zone_size; |
| 517 | sector_t zone_start = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | h = 0; |
raz ben yehuda | 1b96142 | 2009-06-16 16:57:40 +1000 | [diff] [blame] | 519 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | for (j = 0; j < conf->nr_strip_zones; j++) { |
| 521 | seq_printf(seq, " z%d", j); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | seq_printf(seq, "=["); |
| 523 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) |
NeilBrown | 8299d7f | 2007-10-16 23:30:53 -0700 | [diff] [blame] | 524 | seq_printf(seq, "%s/", bdevname( |
raz ben yehuda | 1b96142 | 2009-06-16 16:57:40 +1000 | [diff] [blame] | 525 | conf->devlist[j*mddev->raid_disks + k] |
| 526 | ->bdev, b)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | |
raz ben yehuda | 1b96142 | 2009-06-16 16:57:40 +1000 | [diff] [blame] | 528 | zone_size = conf->strip_zone[j].zone_end - zone_start; |
| 529 | seq_printf(seq, "] ze=%lld ds=%lld s=%lld\n", |
| 530 | (unsigned long long)zone_start>>1, |
| 531 | (unsigned long long)conf->strip_zone[j].dev_start>>1, |
| 532 | (unsigned long long)zone_size>>1); |
| 533 | zone_start = conf->strip_zone[j].zone_end; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | } |
| 535 | #endif |
Andre Noll | 9d8f036 | 2009-06-18 08:45:01 +1000 | [diff] [blame] | 536 | seq_printf(seq, " %dk chunks", mddev->chunk_sectors / 2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | return; |
| 538 | } |
| 539 | |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 540 | static struct mdk_personality raid0_personality= |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | { |
| 542 | .name = "raid0", |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 543 | .level = 0, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | .owner = THIS_MODULE, |
| 545 | .make_request = raid0_make_request, |
| 546 | .run = raid0_run, |
| 547 | .stop = raid0_stop, |
| 548 | .status = raid0_status, |
Dan Williams | 80c3a6c | 2009-03-17 18:10:40 -0700 | [diff] [blame] | 549 | .size = raid0_size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | }; |
| 551 | |
| 552 | static int __init raid0_init (void) |
| 553 | { |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 554 | return register_md_personality (&raid0_personality); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | } |
| 556 | |
| 557 | static void raid0_exit (void) |
| 558 | { |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 559 | unregister_md_personality (&raid0_personality); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | module_init(raid0_init); |
| 563 | module_exit(raid0_exit); |
| 564 | MODULE_LICENSE("GPL"); |
| 565 | MODULE_ALIAS("md-personality-2"); /* RAID0 */ |
NeilBrown | d9d166c | 2006-01-06 00:20:51 -0800 | [diff] [blame] | 566 | MODULE_ALIAS("md-raid0"); |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 567 | MODULE_ALIAS("md-level-0"); |