aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 47818d8249cb..f16062982383 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -287,9 +287,8 @@ static void free_devices(struct list_head *devices)
287{ 287{
288 struct list_head *tmp, *next; 288 struct list_head *tmp, *next;
289 289
290 for (tmp = devices->next; tmp != devices; tmp = next) { 290 list_for_each_safe(tmp, next, devices) {
291 struct dm_dev *dd = list_entry(tmp, struct dm_dev, list); 291 struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
292 next = tmp->next;
293 kfree(dd); 292 kfree(dd);
294 } 293 }
295} 294}
@@ -476,7 +475,7 @@ static int __table_get_device(struct dm_table *t, struct dm_target *ti,
476 int mode, struct dm_dev **result) 475 int mode, struct dm_dev **result)
477{ 476{
478 int r; 477 int r;
479 dev_t dev; 478 dev_t uninitialized_var(dev);
480 struct dm_dev *dd; 479 struct dm_dev *dd;
481 unsigned int major, minor; 480 unsigned int major, minor;
482 481
@@ -805,7 +804,7 @@ static int setup_indexes(struct dm_table *t)
805 return -ENOMEM; 804 return -ENOMEM;
806 805
807 /* set up internal nodes, bottom-up */ 806 /* set up internal nodes, bottom-up */
808 for (i = t->depth - 2, total = 0; i >= 0; i--) { 807 for (i = t->depth - 2; i >= 0; i--) {
809 t->index[i] = indexes; 808 t->index[i] = indexes;
810 indexes += (KEYS_PER_NODE * t->counts[i]); 809 indexes += (KEYS_PER_NODE * t->counts[i]);
811 setup_btree_index(i, t); 810 setup_btree_index(i, t);
@@ -993,12 +992,11 @@ int dm_table_resume_targets(struct dm_table *t)
993 992
994int dm_table_any_congested(struct dm_table *t, int bdi_bits) 993int dm_table_any_congested(struct dm_table *t, int bdi_bits)
995{ 994{
996 struct list_head *d, *devices; 995 struct dm_dev *dd;
996 struct list_head *devices = dm_table_get_devices(t);
997 int r = 0; 997 int r = 0;
998 998
999 devices = dm_table_get_devices(t); 999 list_for_each_entry(dd, devices, list) {
1000 for (d = devices->next; d != devices; d = d->next) {
1001 struct dm_dev *dd = list_entry(d, struct dm_dev, list);
1002 struct request_queue *q = bdev_get_queue(dd->bdev); 1000 struct request_queue *q = bdev_get_queue(dd->bdev);
1003 r |= bdi_congested(&q->backing_dev_info, bdi_bits); 1001 r |= bdi_congested(&q->backing_dev_info, bdi_bits);
1004 } 1002 }
@@ -1008,10 +1006,10 @@ int dm_table_any_congested(struct dm_table *t, int bdi_bits)
1008 1006
1009void dm_table_unplug_all(struct dm_table *t) 1007void dm_table_unplug_all(struct dm_table *t)
1010{ 1008{
1011 struct list_head *d, *devices = dm_table_get_devices(t); 1009 struct dm_dev *dd;
1010 struct list_head *devices = dm_table_get_devices(t);
1012 1011
1013 for (d = devices->next; d != devices; d = d->next) { 1012 list_for_each_entry(dd, devices, list) {
1014 struct dm_dev *dd = list_entry(d, struct dm_dev, list);
1015 struct request_queue *q = bdev_get_queue(dd->bdev); 1013 struct request_queue *q = bdev_get_queue(dd->bdev);
1016 1014
1017 blk_unplug(q); 1015 blk_unplug(q);