aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/faulty.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/faulty.c')
-rw-r--r--drivers/md/faulty.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c
index 8695809b24b0..87d88dbb667f 100644
--- a/drivers/md/faulty.c
+++ b/drivers/md/faulty.c
@@ -255,14 +255,14 @@ static void status(struct seq_file *seq, mddev_t *mddev)
255} 255}
256 256
257 257
258static int reconfig(mddev_t *mddev, int layout, int chunk_size) 258static int reshape(mddev_t *mddev)
259{ 259{
260 int mode = layout & ModeMask; 260 int mode = mddev->new_layout & ModeMask;
261 int count = layout >> ModeShift; 261 int count = mddev->new_layout >> ModeShift;
262 conf_t *conf = mddev->private; 262 conf_t *conf = mddev->private;
263 263
264 if (chunk_size != -1) 264 if (mddev->new_layout < 0)
265 return -EINVAL; 265 return 0;
266 266
267 /* new layout */ 267 /* new layout */
268 if (mode == ClearFaults) 268 if (mode == ClearFaults)
@@ -279,6 +279,7 @@ static int reconfig(mddev_t *mddev, int layout, int chunk_size)
279 atomic_set(&conf->counters[mode], count); 279 atomic_set(&conf->counters[mode], count);
280 } else 280 } else
281 return -EINVAL; 281 return -EINVAL;
282 mddev->new_layout = -1;
282 mddev->layout = -1; /* makes sure further changes come through */ 283 mddev->layout = -1; /* makes sure further changes come through */
283 return 0; 284 return 0;
284} 285}
@@ -298,8 +299,12 @@ static int run(mddev_t *mddev)
298{ 299{
299 mdk_rdev_t *rdev; 300 mdk_rdev_t *rdev;
300 int i; 301 int i;
302 conf_t *conf;
303
304 if (md_check_no_bitmap(mddev))
305 return -EINVAL;
301 306
302 conf_t *conf = kmalloc(sizeof(*conf), GFP_KERNEL); 307 conf = kmalloc(sizeof(*conf), GFP_KERNEL);
303 if (!conf) 308 if (!conf)
304 return -ENOMEM; 309 return -ENOMEM;
305 310
@@ -315,7 +320,7 @@ static int run(mddev_t *mddev)
315 md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); 320 md_set_array_sectors(mddev, faulty_size(mddev, 0, 0));
316 mddev->private = conf; 321 mddev->private = conf;
317 322
318 reconfig(mddev, mddev->layout, -1); 323 reshape(mddev);
319 324
320 return 0; 325 return 0;
321} 326}
@@ -338,7 +343,7 @@ static struct mdk_personality faulty_personality =
338 .run = run, 343 .run = run,
339 .stop = stop, 344 .stop = stop,
340 .status = status, 345 .status = status,
341 .reconfig = reconfig, 346 .check_reshape = reshape,
342 .size = faulty_size, 347 .size = faulty_size,
343}; 348};
344 349