block: move bio list helpers into bio.h
[safe/jmp/linux-2.6] / drivers / md / dm-mpath.c
index abf6e8c..6a386ab 100644 (file)
@@ -8,7 +8,6 @@
 #include <linux/device-mapper.h>
 
 #include "dm-path-selector.h"
-#include "dm-bio-list.h"
 #include "dm-bio-record.h"
 #include "dm-uevent.h"
 
@@ -441,13 +440,13 @@ static void process_queued_ios(struct work_struct *work)
                __choose_pgpath(m);
 
        pgpath = m->current_pgpath;
-       m->pgpath_to_activate = m->current_pgpath;
 
        if ((pgpath && !m->queue_io) ||
            (!pgpath && !m->queue_if_no_path))
                must_queue = 0;
 
-       if (m->pg_init_required && !m->pg_init_in_progress) {
+       if (m->pg_init_required && !m->pg_init_in_progress && pgpath) {
+               m->pgpath_to_activate = pgpath;
                m->pg_init_count++;
                m->pg_init_required = 0;
                m->pg_init_in_progress = 1;
@@ -708,6 +707,10 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m)
                m->hw_handler_name = NULL;
                return -EINVAL;
        }
+
+       if (hw_argc > 1)
+               DMWARN("Ignoring user-specified arguments for "
+                      "hardware handler \"%s\"", m->hw_handler_name);
        consume(as, hw_argc - 1);
 
        return 0;
@@ -885,7 +888,7 @@ static int fail_path(struct pgpath *pgpath)
        dm_path_uevent(DM_UEVENT_PATH_FAILED, m->ti,
                      pgpath->path.dev->name, m->nr_valid_paths);
 
-       queue_work(kmultipathd, &m->trigger_event);
+       schedule_work(&m->trigger_event);
        queue_work(kmultipathd, &pgpath->deactivate_path);
 
 out:
@@ -928,7 +931,7 @@ static int reinstate_path(struct pgpath *pgpath)
        dm_path_uevent(DM_UEVENT_PATH_REINSTATED, m->ti,
                      pgpath->path.dev->name, m->nr_valid_paths);
 
-       queue_work(kmultipathd, &m->trigger_event);
+       schedule_work(&m->trigger_event);
 
 out:
        spin_unlock_irqrestore(&m->lock, flags);
@@ -972,7 +975,7 @@ static void bypass_pg(struct multipath *m, struct priority_group *pg,
 
        spin_unlock_irqrestore(&m->lock, flags);
 
-       queue_work(kmultipathd, &m->trigger_event);
+       schedule_work(&m->trigger_event);
 }
 
 /*
@@ -1002,7 +1005,7 @@ static int switch_pg_num(struct multipath *m, const char *pgstr)
        }
        spin_unlock_irqrestore(&m->lock, flags);
 
-       queue_work(kmultipathd, &m->trigger_event);
+       schedule_work(&m->trigger_event);
        return 0;
 }
 
@@ -1396,19 +1399,15 @@ error:
        return -EINVAL;
 }
 
-static int multipath_ioctl(struct dm_target *ti, struct inode *inode,
-                          struct file *filp, unsigned int cmd,
+static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
                           unsigned long arg)
 {
        struct multipath *m = (struct multipath *) ti->private;
        struct block_device *bdev = NULL;
+       fmode_t mode = 0;
        unsigned long flags;
-       struct file fake_file = {};
-       struct dentry fake_dentry = {};
        int r = 0;
 
-       fake_file.f_path.dentry = &fake_dentry;
-
        spin_lock_irqsave(&m->lock, flags);
 
        if (!m->current_pgpath)
@@ -1416,8 +1415,7 @@ static int multipath_ioctl(struct dm_target *ti, struct inode *inode,
 
        if (m->current_pgpath) {
                bdev = m->current_pgpath->path.dev->bdev;
-               fake_dentry.d_inode = bdev->bd_inode;
-               fake_file.f_mode = m->current_pgpath->path.dev->mode;
+               mode = m->current_pgpath->path.dev->mode;
        }
 
        if (m->queue_io)
@@ -1427,8 +1425,7 @@ static int multipath_ioctl(struct dm_target *ti, struct inode *inode,
 
        spin_unlock_irqrestore(&m->lock, flags);
 
-       return r ? : blkdev_driver_ioctl(bdev->bd_inode, &fake_file,
-                                        bdev->bd_disk, cmd, arg);
+       return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);
 }
 
 /*-----------------------------------------------------------------
@@ -1497,14 +1494,10 @@ static int __init dm_multipath_init(void)
 
 static void __exit dm_multipath_exit(void)
 {
-       int r;
-
        destroy_workqueue(kmpath_handlerd);
        destroy_workqueue(kmultipathd);
 
-       r = dm_unregister_target(&multipath_target);
-       if (r < 0)
-               DMERR("target unregister failed %d", r);
+       dm_unregister_target(&multipath_target);
        kmem_cache_destroy(_mpio_cache);
 }