aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 14:39:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 14:39:52 -0400
commit88ed806abb981cc8ec61ee7fab93ecfe63521ebf (patch)
treef3639f4a6862598fcdbb444ef4b5bbceb63d5c46 /drivers/md
parente56d9fccb1c78283d7c163bb354be7cbbc93d9fb (diff)
parentb395f75eabb3844c99244928293796ff42feaa3d (diff)
Merge tag 'md/3.18' of git://neil.brown.name/md
Pull md updates from Neil Brown: - a few minor bug fixes - quite a lot of code tidy-up and simplification - remove PRINT_RAID_DEBUG ioctl. I'm fairly sure it is unused, and it isn't particularly useful. * tag 'md/3.18' of git://neil.brown.name/md: (21 commits) lib/raid6: Add log level to printks md: move EXPORT_SYMBOL to after function in md.c md: discard PRINT_RAID_DEBUG ioctl md: remove MD_BUG() md: clean up 'exit' labels in md_ioctl(). md: remove unnecessary test for MD_MAJOR in md_ioctl() md: don't allow "-sync" to be set for device in an active array. md: remove unwanted white space from md.c md: don't start resync thread directly from md thread. md: Just use RCU when checking for overlap between arrays. md: avoid potential long delay under pers_lock md: simplify export_array() md: discard find_rdev_nr in favour of find_rdev_nr_rcu md: use wait_event() to simplify md_super_wait() md: be more relaxed about stopping an array which isn't started. md/raid1: process_checks doesn't use its return value. md/raid5: fix init_stripe() inconsistencies md/raid10: another memory leak due to reshape. md: use set_bit/clear_bit instead of shift/mask for bi_flags changes. md/raid1: minor typos and reformatting. ...
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bitmap.c16
-rw-r--r--drivers/md/linear.c8
-rw-r--r--drivers/md/md.c601
-rw-r--r--drivers/md/md.h34
-rw-r--r--drivers/md/multipath.c28
-rw-r--r--drivers/md/raid0.c9
-rw-r--r--drivers/md/raid1.c37
-rw-r--r--drivers/md/raid1.h2
-rw-r--r--drivers/md/raid10.c18
-rw-r--r--drivers/md/raid5.c29
-rw-r--r--drivers/md/raid5.h4
11 files changed, 260 insertions, 526 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 67f8b31e2054..da3604e73e8a 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -879,7 +879,6 @@ void bitmap_unplug(struct bitmap *bitmap)
879{ 879{
880 unsigned long i; 880 unsigned long i;
881 int dirty, need_write; 881 int dirty, need_write;
882 int wait = 0;
883 882
884 if (!bitmap || !bitmap->storage.filemap || 883 if (!bitmap || !bitmap->storage.filemap ||
885 test_bit(BITMAP_STALE, &bitmap->flags)) 884 test_bit(BITMAP_STALE, &bitmap->flags))
@@ -897,16 +896,13 @@ void bitmap_unplug(struct bitmap *bitmap)
897 clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING); 896 clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING);
898 write_page(bitmap, bitmap->storage.filemap[i], 0); 897 write_page(bitmap, bitmap->storage.filemap[i], 0);
899 } 898 }
900 if (dirty)
901 wait = 1;
902 }
903 if (wait) { /* if any writes were performed, we need to wait on them */
904 if (bitmap->storage.file)
905 wait_event(bitmap->write_wait,
906 atomic_read(&bitmap->pending_writes)==0);
907 else
908 md_super_wait(bitmap->mddev);
909 } 899 }
900 if (bitmap->storage.file)
901 wait_event(bitmap->write_wait,
902 atomic_read(&bitmap->pending_writes)==0);
903 else
904 md_super_wait(bitmap->mddev);
905
910 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags)) 906 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags))
911 bitmap_file_kick(bitmap); 907 bitmap_file_kick(bitmap);
912} 908}
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 56f534b4a2d2..64713b77df1c 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -10,10 +10,10 @@
10 it under the terms of the GNU General Public License as published by 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) 11 the Free Software Foundation; either version 2, or (at your option)
12 any later version. 12 any later version.
13 13
14 You should have received a copy of the GNU General Public License 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 15 (for example /usr/src/linux/COPYING); if not, write to the Free
16 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17*/ 17*/
18 18
19#include <linux/blkdev.h> 19#include <linux/blkdev.h>
@@ -25,7 +25,7 @@
25#include "linear.h" 25#include "linear.h"
26 26
27/* 27/*
28 * find which device holds a particular offset 28 * find which device holds a particular offset
29 */ 29 */
30static inline struct dev_info *which_dev(struct mddev *mddev, sector_t sector) 30static inline struct dev_info *which_dev(struct mddev *mddev, sector_t sector)
31{ 31{
@@ -355,7 +355,6 @@ static void linear_status (struct seq_file *seq, struct mddev *mddev)
355 seq_printf(seq, " %dk rounding", mddev->chunk_sectors / 2); 355 seq_printf(seq, " %dk rounding", mddev->chunk_sectors / 2);
356} 356}
357 357
358
359static struct md_personality linear_personality = 358static struct md_personality linear_personality =
360{ 359{
361 .name = "linear", 360 .name = "linear",
@@ -379,7 +378,6 @@ static void linear_exit (void)
379 unregister_md_personality (&linear_personality); 378 unregister_md_personality (&linear_personality);
380} 379}
381 380
382
383module_init(linear_init); 381module_init(linear_init);
384module_exit(linear_exit); 382module_exit(linear_exit);
385MODULE_LICENSE("GPL"); 383MODULE_LICENSE("GPL");
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1294238610df..4dfa15da9cb8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1,6 +1,6 @@
1/* 1/*
2 md.c : Multiple Devices driver for Linux 2 md.c : Multiple Devices driver for Linux
3 Copyright (C) 1998, 1999, 2000 Ingo Molnar 3 Copyright (C) 1998, 1999, 2000 Ingo Molnar
4 4
5 completely rewritten, based on the MD driver code from Marc Zyngier 5 completely rewritten, based on the MD driver code from Marc Zyngier
6 6
@@ -66,8 +66,6 @@ static void autostart_arrays(int part);
66static LIST_HEAD(pers_list); 66static LIST_HEAD(pers_list);
67static DEFINE_SPINLOCK(pers_lock); 67static DEFINE_SPINLOCK(pers_lock);
68 68
69static void md_print_devices(void);
70
71static DECLARE_WAIT_QUEUE_HEAD(resync_wait); 69static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
72static struct workqueue_struct *md_wq; 70static struct workqueue_struct *md_wq;
73static struct workqueue_struct *md_misc_wq; 71static struct workqueue_struct *md_misc_wq;
@@ -75,8 +73,6 @@ static struct workqueue_struct *md_misc_wq;
75static int remove_and_add_spares(struct mddev *mddev, 73static int remove_and_add_spares(struct mddev *mddev,
76 struct md_rdev *this); 74 struct md_rdev *this);
77 75
78#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
79
80/* 76/*
81 * Default number of read corrections we'll attempt on an rdev 77 * Default number of read corrections we'll attempt on an rdev
82 * before ejecting it from the array. We divide the read error 78 * before ejecting it from the array. We divide the read error
@@ -218,7 +214,6 @@ static void md_new_event_inintr(struct mddev *mddev)
218static LIST_HEAD(all_mddevs); 214static LIST_HEAD(all_mddevs);
219static DEFINE_SPINLOCK(all_mddevs_lock); 215static DEFINE_SPINLOCK(all_mddevs_lock);
220 216
221
222/* 217/*
223 * iterates through all used mddevs in the system. 218 * iterates through all used mddevs in the system.
224 * We take care to grab the all_mddevs_lock whenever navigating 219 * We take care to grab the all_mddevs_lock whenever navigating
@@ -228,7 +223,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
228 */ 223 */
229#define for_each_mddev(_mddev,_tmp) \ 224#define for_each_mddev(_mddev,_tmp) \
230 \ 225 \
231 for (({ spin_lock(&all_mddevs_lock); \ 226 for (({ spin_lock(&all_mddevs_lock); \
232 _tmp = all_mddevs.next; \ 227 _tmp = all_mddevs.next; \
233 _mddev = NULL;}); \ 228 _mddev = NULL;}); \
234 ({ if (_tmp != &all_mddevs) \ 229 ({ if (_tmp != &all_mddevs) \
@@ -241,7 +236,6 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
241 _tmp = _tmp->next;}) \ 236 _tmp = _tmp->next;}) \
242 ) 237 )
243 238
244
245/* Rather than calling directly into the personality make_request function, 239/* Rather than calling directly into the personality make_request function,
246 * IO requests come here first so that we can check if the device is 240 * IO requests come here first so that we can check if the device is
247 * being suspended pending a reconfiguration. 241 * being suspended pending a reconfiguration.
@@ -488,7 +482,7 @@ void mddev_init(struct mddev *mddev)
488} 482}
489EXPORT_SYMBOL_GPL(mddev_init); 483EXPORT_SYMBOL_GPL(mddev_init);
490 484
491static struct mddev * mddev_find(dev_t unit) 485static struct mddev *mddev_find(dev_t unit)
492{ 486{
493 struct mddev *mddev, *new = NULL; 487 struct mddev *mddev, *new = NULL;
494 488
@@ -530,7 +524,7 @@ static struct mddev * mddev_find(dev_t unit)
530 kfree(new); 524 kfree(new);
531 return NULL; 525 return NULL;
532 } 526 }
533 527
534 is_free = 1; 528 is_free = 1;
535 list_for_each_entry(mddev, &all_mddevs, all_mddevs) 529 list_for_each_entry(mddev, &all_mddevs, all_mddevs)
536 if (mddev->unit == dev) { 530 if (mddev->unit == dev) {
@@ -562,7 +556,7 @@ static struct mddev *