Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * faulty.c : Multiple Devices driver for Linux |
| 3 | * |
| 4 | * Copyright (C) 2004 Neil Brown |
| 5 | * |
| 6 | * fautly-device-simulator personality for md |
| 7 | * |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2, or (at your option) |
| 12 | * any later version. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * (for example /usr/src/linux/COPYING); if not, write to the Free |
| 16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | /* |
| 21 | * The "faulty" personality causes some requests to fail. |
| 22 | * |
| 23 | * Possible failure modes are: |
| 24 | * reads fail "randomly" but succeed on retry |
| 25 | * writes fail "randomly" but succeed on retry |
| 26 | * reads for some address fail and then persist until a write |
| 27 | * reads for some address fail and then persist irrespective of write |
| 28 | * writes for some address fail and persist |
| 29 | * all writes fail |
| 30 | * |
| 31 | * Different modes can be active at a time, but only |
| 32 | * one can be set at array creation. Others can be added later. |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 33 | * A mode can be one-shot or recurrent with the recurrence being |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | * once in every N requests. |
| 35 | * The bottom 5 bits of the "layout" indicate the mode. The |
| 36 | * remainder indicate a period, or 0 for one-shot. |
| 37 | * |
| 38 | * There is an implementation limit on the number of concurrently |
| 39 | * persisting-faulty blocks. When a new fault is requested that would |
| 40 | * exceed the limit, it is ignored. |
| 41 | * All current faults can be clear using a layout of "0". |
| 42 | * |
| 43 | * Requests are always sent to the device. If they are to fail, |
| 44 | * we clone the bio and insert a new b_end_io into the chain. |
| 45 | */ |
| 46 | |
| 47 | #define WriteTransient 0 |
| 48 | #define ReadTransient 1 |
| 49 | #define WritePersistent 2 |
| 50 | #define ReadPersistent 3 |
| 51 | #define WriteAll 4 /* doesn't go to device */ |
| 52 | #define ReadFixable 5 |
| 53 | #define Modes 6 |
| 54 | |
| 55 | #define ClearErrors 31 |
| 56 | #define ClearFaults 30 |
| 57 | |
| 58 | #define AllPersist 100 /* internal use only */ |
| 59 | #define NoPersist 101 |
| 60 | |
| 61 | #define ModeMask 0x1f |
| 62 | #define ModeShift 5 |
| 63 | |
| 64 | #define MaxFault 50 |
NeilBrown | bff6197 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 65 | #include <linux/blkdev.h> |
Paul Gortmaker | 056075c | 2011-07-03 13:58:33 -0400 | [diff] [blame] | 66 | #include <linux/module.h> |
NeilBrown | bff6197 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 67 | #include <linux/raid/md_u.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 68 | #include <linux/slab.h> |
NeilBrown | 43b2e5d | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 69 | #include "md.h" |
NeilBrown | bff6197 | 2009-03-31 14:33:13 +1100 | [diff] [blame] | 70 | #include <linux/seq_file.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
| 72 | |
Christoph Hellwig | 4246a0b | 2015-07-20 15:29:37 +0200 | [diff] [blame] | 73 | static void faulty_fail(struct bio *bio) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | { |
| 75 | struct bio *b = bio->bi_private; |
| 76 | |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 77 | b->bi_iter.bi_size = bio->bi_iter.bi_size; |
| 78 | b->bi_iter.bi_sector = bio->bi_iter.bi_sector; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
NeilBrown | 6712ecf | 2007-09-27 12:47:43 +0200 | [diff] [blame] | 80 | bio_put(bio); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
NeilBrown | 6712ecf | 2007-09-27 12:47:43 +0200 | [diff] [blame] | 82 | bio_io_error(b); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | } |
| 84 | |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 85 | struct faulty_conf { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | int period[Modes]; |
| 87 | atomic_t counters[Modes]; |
| 88 | sector_t faults[MaxFault]; |
| 89 | int modes[MaxFault]; |
| 90 | int nfaults; |
NeilBrown | 3cb0300 | 2011-10-11 16:45:26 +1100 | [diff] [blame] | 91 | struct md_rdev *rdev; |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 92 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 94 | static int check_mode(struct faulty_conf *conf, int mode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | { |
| 96 | if (conf->period[mode] == 0 && |
| 97 | atomic_read(&conf->counters[mode]) <= 0) |
| 98 | return 0; /* no failure, no decrement */ |
| 99 | |
| 100 | |
| 101 | if (atomic_dec_and_test(&conf->counters[mode])) { |
| 102 | if (conf->period[mode]) |
| 103 | atomic_set(&conf->counters[mode], conf->period[mode]); |
| 104 | return 1; |
| 105 | } |
| 106 | return 0; |
| 107 | } |
| 108 | |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 109 | static int check_sector(struct faulty_conf *conf, sector_t start, sector_t end, int dir) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | { |
| 111 | /* If we find a ReadFixable sector, we fix it ... */ |
| 112 | int i; |
| 113 | for (i=0; i<conf->nfaults; i++) |
| 114 | if (conf->faults[i] >= start && |
| 115 | conf->faults[i] < end) { |
| 116 | /* found it ... */ |
| 117 | switch (conf->modes[i] * 2 + dir) { |
| 118 | case WritePersistent*2+WRITE: return 1; |
| 119 | case ReadPersistent*2+READ: return 1; |
| 120 | case ReadFixable*2+READ: return 1; |
| 121 | case ReadFixable*2+WRITE: |
| 122 | conf->modes[i] = NoPersist; |
| 123 | return 0; |
| 124 | case AllPersist*2+READ: |
| 125 | case AllPersist*2+WRITE: return 1; |
| 126 | default: |
| 127 | return 0; |
| 128 | } |
| 129 | } |
| 130 | return 0; |
| 131 | } |
| 132 | |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 133 | static void add_sector(struct faulty_conf *conf, sector_t start, int mode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | { |
| 135 | int i; |
| 136 | int n = conf->nfaults; |
| 137 | for (i=0; i<conf->nfaults; i++) |
| 138 | if (conf->faults[i] == start) { |
| 139 | switch(mode) { |
| 140 | case NoPersist: conf->modes[i] = mode; return; |
| 141 | case WritePersistent: |
| 142 | if (conf->modes[i] == ReadPersistent || |
| 143 | conf->modes[i] == ReadFixable) |
| 144 | conf->modes[i] = AllPersist; |
| 145 | else |
| 146 | conf->modes[i] = WritePersistent; |
| 147 | return; |
| 148 | case ReadPersistent: |
| 149 | if (conf->modes[i] == WritePersistent) |
| 150 | conf->modes[i] = AllPersist; |
| 151 | else |
| 152 | conf->modes[i] = ReadPersistent; |
| 153 | return; |
| 154 | case ReadFixable: |
| 155 | if (conf->modes[i] == WritePersistent || |
| 156 | conf->modes[i] == ReadPersistent) |
| 157 | conf->modes[i] = AllPersist; |
| 158 | else |
| 159 | conf->modes[i] = ReadFixable; |
| 160 | return; |
| 161 | } |
| 162 | } else if (conf->modes[i] == NoPersist) |
| 163 | n = i; |
| 164 | |
| 165 | if (n >= MaxFault) |
| 166 | return; |
| 167 | conf->faults[n] = start; |
| 168 | conf->modes[n] = mode; |
| 169 | if (conf->nfaults == n) |
| 170 | conf->nfaults = n+1; |
| 171 | } |
| 172 | |
Shaohua Li | 849674e | 2016-01-20 13:52:20 -0800 | [diff] [blame] | 173 | static void faulty_make_request(struct mddev *mddev, struct bio *bio) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | { |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 175 | struct faulty_conf *conf = mddev->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | int failit = 0; |
| 177 | |
NeilBrown | 802ba06 | 2006-12-13 00:34:13 -0800 | [diff] [blame] | 178 | if (bio_data_dir(bio) == WRITE) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | /* write request */ |
| 180 | if (atomic_read(&conf->counters[WriteAll])) { |
| 181 | /* special case - don't decrement, don't generic_make_request, |
| 182 | * just fail immediately |
| 183 | */ |
Christoph Hellwig | 4246a0b | 2015-07-20 15:29:37 +0200 | [diff] [blame] | 184 | bio_io_error(bio); |
Christoph Hellwig | 5a7bbad | 2011-09-12 12:12:01 +0200 | [diff] [blame] | 185 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | } |
| 187 | |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 188 | if (check_sector(conf, bio->bi_iter.bi_sector, |
| 189 | bio_end_sector(bio), WRITE)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | failit = 1; |
| 191 | if (check_mode(conf, WritePersistent)) { |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 192 | add_sector(conf, bio->bi_iter.bi_sector, |
| 193 | WritePersistent); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | failit = 1; |
| 195 | } |
| 196 | if (check_mode(conf, WriteTransient)) |
| 197 | failit = 1; |
| 198 | } else { |
| 199 | /* read request */ |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 200 | if (check_sector(conf, bio->bi_iter.bi_sector, |
| 201 | bio_end_sector(bio), READ)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | failit = 1; |
| 203 | if (check_mode(conf, ReadTransient)) |
| 204 | failit = 1; |
| 205 | if (check_mode(conf, ReadPersistent)) { |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 206 | add_sector(conf, bio->bi_iter.bi_sector, |
| 207 | ReadPersistent); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | failit = 1; |
| 209 | } |
| 210 | if (check_mode(conf, ReadFixable)) { |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 211 | add_sector(conf, bio->bi_iter.bi_sector, |
| 212 | ReadFixable); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | failit = 1; |
| 214 | } |
| 215 | } |
| 216 | if (failit) { |
NeilBrown | a167f66 | 2010-10-26 18:31:13 +1100 | [diff] [blame] | 217 | struct bio *b = bio_clone_mddev(bio, GFP_NOIO, mddev); |
Christoph Hellwig | 5a7bbad | 2011-09-12 12:12:01 +0200 | [diff] [blame] | 218 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | b->bi_bdev = conf->rdev->bdev; |
| 220 | b->bi_private = bio; |
| 221 | b->bi_end_io = faulty_fail; |
Christoph Hellwig | 5a7bbad | 2011-09-12 12:12:01 +0200 | [diff] [blame] | 222 | bio = b; |
| 223 | } else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | bio->bi_bdev = conf->rdev->bdev; |
Christoph Hellwig | 5a7bbad | 2011-09-12 12:12:01 +0200 | [diff] [blame] | 225 | |
| 226 | generic_make_request(bio); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | } |
| 228 | |
Shaohua Li | 849674e | 2016-01-20 13:52:20 -0800 | [diff] [blame] | 229 | static void faulty_status(struct seq_file *seq, struct mddev *mddev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | { |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 231 | struct faulty_conf *conf = mddev->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | int n; |
| 233 | |
| 234 | if ((n=atomic_read(&conf->counters[WriteTransient])) != 0) |
| 235 | seq_printf(seq, " WriteTransient=%d(%d)", |
| 236 | n, conf->period[WriteTransient]); |
| 237 | |
| 238 | if ((n=atomic_read(&conf->counters[ReadTransient])) != 0) |
| 239 | seq_printf(seq, " ReadTransient=%d(%d)", |
| 240 | n, conf->period[ReadTransient]); |
| 241 | |
| 242 | if ((n=atomic_read(&conf->counters[WritePersistent])) != 0) |
| 243 | seq_printf(seq, " WritePersistent=%d(%d)", |
| 244 | n, conf->period[WritePersistent]); |
| 245 | |
| 246 | if ((n=atomic_read(&conf->counters[ReadPersistent])) != 0) |
| 247 | seq_printf(seq, " ReadPersistent=%d(%d)", |
| 248 | n, conf->period[ReadPersistent]); |
| 249 | |
| 250 | |
| 251 | if ((n=atomic_read(&conf->counters[ReadFixable])) != 0) |
| 252 | seq_printf(seq, " ReadFixable=%d(%d)", |
| 253 | n, conf->period[ReadFixable]); |
| 254 | |
| 255 | if ((n=atomic_read(&conf->counters[WriteAll])) != 0) |
| 256 | seq_printf(seq, " WriteAll"); |
| 257 | |
| 258 | seq_printf(seq, " nfaults=%d", conf->nfaults); |
| 259 | } |
| 260 | |
| 261 | |
Shaohua Li | 849674e | 2016-01-20 13:52:20 -0800 | [diff] [blame] | 262 | static int faulty_reshape(struct mddev *mddev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | { |
NeilBrown | 597a711 | 2009-06-18 08:47:42 +1000 | [diff] [blame] | 264 | int mode = mddev->new_layout & ModeMask; |
| 265 | int count = mddev->new_layout >> ModeShift; |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 266 | struct faulty_conf *conf = mddev->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
NeilBrown | 597a711 | 2009-06-18 08:47:42 +1000 | [diff] [blame] | 268 | if (mddev->new_layout < 0) |
| 269 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | |
| 271 | /* new layout */ |
| 272 | if (mode == ClearFaults) |
| 273 | conf->nfaults = 0; |
| 274 | else if (mode == ClearErrors) { |
| 275 | int i; |
| 276 | for (i=0 ; i < Modes ; i++) { |
| 277 | conf->period[i] = 0; |
| 278 | atomic_set(&conf->counters[i], 0); |
| 279 | } |
| 280 | } else if (mode < Modes) { |
| 281 | conf->period[mode] = count; |
| 282 | if (!count) count++; |
| 283 | atomic_set(&conf->counters[mode], count); |
| 284 | } else |
| 285 | return -EINVAL; |
NeilBrown | 597a711 | 2009-06-18 08:47:42 +1000 | [diff] [blame] | 286 | mddev->new_layout = -1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | mddev->layout = -1; /* makes sure further changes come through */ |
| 288 | return 0; |
| 289 | } |
| 290 | |
NeilBrown | fd01b88 | 2011-10-11 16:47:53 +1100 | [diff] [blame] | 291 | static sector_t faulty_size(struct mddev *mddev, sector_t sectors, int raid_disks) |
Dan Williams | 80c3a6c | 2009-03-17 18:10:40 -0700 | [diff] [blame] | 292 | { |
| 293 | WARN_ONCE(raid_disks, |
| 294 | "%s does not support generic reshape\n", __func__); |
| 295 | |
| 296 | if (sectors == 0) |
| 297 | return mddev->dev_sectors; |
| 298 | |
| 299 | return sectors; |
| 300 | } |
| 301 | |
Shaohua Li | 849674e | 2016-01-20 13:52:20 -0800 | [diff] [blame] | 302 | static int faulty_run(struct mddev *mddev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | { |
NeilBrown | 3cb0300 | 2011-10-11 16:45:26 +1100 | [diff] [blame] | 304 | struct md_rdev *rdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | int i; |
NeilBrown | 8f1ae43 | 2011-10-11 16:48:52 +1100 | [diff] [blame] | 306 | struct faulty_conf *conf; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
Andre Noll | 0894cc3 | 2009-06-18 08:49:23 +1000 | [diff] [blame] | 308 | if (md_check_no_bitmap(mddev)) |
| 309 | return -EINVAL; |
| 310 | |
| 311 | conf = kmalloc(sizeof(*conf), GFP_KERNEL); |
Sven Wegener | 08ff39f | 2008-10-16 14:16:53 +1100 | [diff] [blame] | 312 | if (!conf) |
| 313 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
| 315 | for (i=0; i<Modes; i++) { |
| 316 | atomic_set(&conf->counters[i], 0); |
| 317 | conf->period[i] = 0; |
| 318 | } |
| 319 | conf->nfaults = 0; |
| 320 | |
Eric Sandeen | 0be1fec | 2012-10-22 10:44:55 +1100 | [diff] [blame] | 321 | rdev_for_each(rdev, mddev) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | conf->rdev = rdev; |
Eric Sandeen | 0be1fec | 2012-10-22 10:44:55 +1100 | [diff] [blame] | 323 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
| 324 | rdev->data_offset << 9); |
| 325 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Dan Williams | 1f40362 | 2009-03-31 14:59:03 +1100 | [diff] [blame] | 327 | md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | mddev->private = conf; |
| 329 | |
Shaohua Li | 849674e | 2016-01-20 13:52:20 -0800 | [diff] [blame] | 330 | faulty_reshape(mddev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | |
| 332 | return 0; |
| 333 | } |
| 334 | |
NeilBrown | afa0f55 | 2014-12-15 12:56:58 +1100 | [diff] [blame] | 335 | static void faulty_free(struct mddev *mddev, void *priv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | { |
NeilBrown | afa0f55 | 2014-12-15 12:56:58 +1100 | [diff] [blame] | 337 | struct faulty_conf *conf = priv; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | |
| 339 | kfree(conf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | } |
| 341 | |
NeilBrown | 84fc4b5 | 2011-10-11 16:49:58 +1100 | [diff] [blame] | 342 | static struct md_personality faulty_personality = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | { |
| 344 | .name = "faulty", |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 345 | .level = LEVEL_FAULTY, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | .owner = THIS_MODULE, |
Shaohua Li | 849674e | 2016-01-20 13:52:20 -0800 | [diff] [blame] | 347 | .make_request = faulty_make_request, |
| 348 | .run = faulty_run, |
NeilBrown | afa0f55 | 2014-12-15 12:56:58 +1100 | [diff] [blame] | 349 | .free = faulty_free, |
Shaohua Li | 849674e | 2016-01-20 13:52:20 -0800 | [diff] [blame] | 350 | .status = faulty_status, |
| 351 | .check_reshape = faulty_reshape, |
Dan Williams | 80c3a6c | 2009-03-17 18:10:40 -0700 | [diff] [blame] | 352 | .size = faulty_size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | }; |
| 354 | |
| 355 | static int __init raid_init(void) |
| 356 | { |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 357 | return register_md_personality(&faulty_personality); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | static void raid_exit(void) |
| 361 | { |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 362 | unregister_md_personality(&faulty_personality); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | module_init(raid_init); |
| 366 | module_exit(raid_exit); |
| 367 | MODULE_LICENSE("GPL"); |
NeilBrown | 0efb9e6 | 2009-12-14 12:49:58 +1100 | [diff] [blame] | 368 | MODULE_DESCRIPTION("Fault injection personality for MD"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | MODULE_ALIAS("md-personality-10"); /* faulty */ |
NeilBrown | d9d166c | 2006-01-06 00:20:51 -0800 | [diff] [blame] | 370 | MODULE_ALIAS("md-faulty"); |
NeilBrown | 2604b70 | 2006-01-06 00:20:36 -0800 | [diff] [blame] | 371 | MODULE_ALIAS("md-level--5"); |