]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - drivers/md/multipath.c
video: tegra: nvmap: add handle share count to debug stats
[linux-3.10.git] / drivers / md / multipath.c
index ad20a28fbf2aeee9a2df68a41113510fee604686..1642eae75a3335d1282a4bf53751802e1aeb52db 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/blkdev.h>
+#include <linux/module.h>
 #include <linux/raid/md_u.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
@@ -291,17 +292,16 @@ static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev)
        return err;
 }
 
-static int multipath_remove_disk(struct mddev *mddev, int number)
+static int multipath_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
 {
        struct mpconf *conf = mddev->private;
        int err = 0;
-       struct md_rdev *rdev;
+       int number = rdev->raid_disk;
        struct multipath_info *p = conf->multipaths + number;
 
        print_multipath_conf(conf);
 
-       rdev = p->rdev;
-       if (rdev) {
+       if (rdev == p->rdev) {
                if (test_bit(In_sync, &rdev->flags) ||
                    atomic_read(&rdev->nr_pending)) {
                        printk(KERN_ERR "hot-remove-disk, slot %d is identified"
@@ -335,8 +335,9 @@ abort:
  *     3.      Performs writes following reads for array syncronising.
  */
 
-static void multipathd (struct mddev *mddev)
+static void multipathd(struct md_thread *thread)
 {
+       struct mddev *mddev = thread->mddev;
        struct multipath_bh *mp_bh;
        struct bio *bio;
        unsigned long flags;
@@ -428,7 +429,7 @@ static int multipath_run (struct mddev *mddev)
        }
 
        working_disks = 0;
-       list_for_each_entry(rdev, &mddev->disks, same_set) {
+       rdev_for_each(rdev, mddev) {
                disk_idx = rdev->raid_disk;
                if (disk_idx < 0 ||
                    disk_idx >= mddev->raid_disks)
@@ -474,7 +475,8 @@ static int multipath_run (struct mddev *mddev)
        }
 
        {
-               mddev->thread = md_register_thread(multipathd, mddev, NULL);
+               mddev->thread = md_register_thread(multipathd, mddev,
+                                                  "multipath");
                if (!mddev->thread) {
                        printk(KERN_ERR "multipath: couldn't allocate thread"
                                " for %s\n", mdname(mddev));