Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[pandora-kernel.git] / drivers / md / dm-table.c
index 47818d8..73326e7 100644 (file)
@@ -245,51 +245,12 @@ int dm_table_create(struct dm_table **result, int mode,
        return 0;
 }
 
-int dm_create_error_table(struct dm_table **result, struct mapped_device *md)
-{
-       struct dm_table *t;
-       sector_t dev_size = 1;
-       int r;
-
-       /*
-        * Find current size of device.
-        * Default to 1 sector if inactive.
-        */
-       t = dm_get_table(md);
-       if (t) {
-               dev_size = dm_table_get_size(t);
-               dm_table_put(t);
-       }
-
-       r = dm_table_create(&t, FMODE_READ, 1, md);
-       if (r)
-               return r;
-
-       r = dm_table_add_target(t, "error", 0, dev_size, NULL);
-       if (r)
-               goto out;
-
-       r = dm_table_complete(t);
-       if (r)
-               goto out;
-
-       *result = t;
-
-out:
-       if (r)
-               dm_table_put(t);
-
-       return r;
-}
-EXPORT_SYMBOL_GPL(dm_create_error_table);
-
 static void free_devices(struct list_head *devices)
 {
        struct list_head *tmp, *next;
 
-       for (tmp = devices->next; tmp != devices; tmp = next) {
+       list_for_each_safe(tmp, next, devices) {
                struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
-               next = tmp->next;
                kfree(dd);
        }
 }
@@ -362,7 +323,7 @@ static int lookup_device(const char *path, dev_t *dev)
        if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd)))
                return r;
 
-       inode = nd.dentry->d_inode;
+       inode = nd.path.dentry->d_inode;
        if (!inode) {
                r = -ENOENT;
                goto out;
@@ -376,7 +337,7 @@ static int lookup_device(const char *path, dev_t *dev)
        *dev = inode->i_rdev;
 
  out:
-       path_release(&nd);
+       path_put(&nd.path);
        return r;
 }
 
@@ -476,7 +437,7 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
                              int mode, struct dm_dev **result)
 {
        int r;
-       dev_t dev;
+       dev_t uninitialized_var(dev);
        struct dm_dev *dd;
        unsigned int major, minor;
 
@@ -805,7 +766,7 @@ static int setup_indexes(struct dm_table *t)
                return -ENOMEM;
 
        /* set up internal nodes, bottom-up */
-       for (i = t->depth - 2, total = 0; i >= 0; i--) {
+       for (i = t->depth - 2; i >= 0; i--) {
                t->index[i] = indexes;
                indexes += (KEYS_PER_NODE * t->counts[i]);
                setup_btree_index(i, t);
@@ -912,10 +873,13 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
        q->max_hw_sectors = t->limits.max_hw_sectors;
        q->seg_boundary_mask = t->limits.seg_boundary_mask;
        q->bounce_pfn = t->limits.bounce_pfn;
+       /* XXX: the below will probably go bug. must ensure there can be no
+        * concurrency on queue_flags, and use the unlocked versions...
+        */
        if (t->limits.no_cluster)
-               q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER);
+               queue_flag_clear(QUEUE_FLAG_CLUSTER, q);
        else
-               q->queue_flags |= (1 << QUEUE_FLAG_CLUSTER);
+               queue_flag_set(QUEUE_FLAG_CLUSTER, q);
 
 }
 
@@ -955,7 +919,7 @@ void dm_table_presuspend_targets(struct dm_table *t)
        if (!t)
                return;
 
-       return suspend_targets(t, 0);
+       suspend_targets(t, 0);
 }
 
 void dm_table_postsuspend_targets(struct dm_table *t)
@@ -963,7 +927,7 @@ void dm_table_postsuspend_targets(struct dm_table *t)
        if (!t)
                return;
 
-       return suspend_targets(t, 1);
+       suspend_targets(t, 1);
 }
 
 int dm_table_resume_targets(struct dm_table *t)
@@ -993,12 +957,11 @@ int dm_table_resume_targets(struct dm_table *t)
 
 int dm_table_any_congested(struct dm_table *t, int bdi_bits)
 {
-       struct list_head *d, *devices;
+       struct dm_dev *dd;
+       struct list_head *devices = dm_table_get_devices(t);
        int r = 0;
 
-       devices = dm_table_get_devices(t);
-       for (d = devices->next; d != devices; d = d->next) {
-               struct dm_dev *dd = list_entry(d, struct dm_dev, list);
+       list_for_each_entry(dd, devices, list) {
                struct request_queue *q = bdev_get_queue(dd->bdev);
                r |= bdi_congested(&q->backing_dev_info, bdi_bits);
        }
@@ -1008,10 +971,10 @@ int dm_table_any_congested(struct dm_table *t, int bdi_bits)
 
 void dm_table_unplug_all(struct dm_table *t)
 {
-       struct list_head *d, *devices = dm_table_get_devices(t);
+       struct dm_dev *dd;
+       struct list_head *devices = dm_table_get_devices(t);
 
-       for (d = devices->next; d != devices; d = d->next) {
-               struct dm_dev *dd = list_entry(d, struct dm_dev, list);
+       list_for_each_entry(dd, devices, list) {
                struct request_queue *q = bdev_get_queue(dd->bdev);
 
                blk_unplug(q);