aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Jimenez <pj@place.org>2008-02-07 21:09:59 -0500
committerAlasdair G Kergon <agk@redhat.com>2008-02-07 21:09:59 -0500
commitafb24528f9012e5c6361ca9a9128c7c089c1cc7c (patch)
tree1aa47aca62308becafc05464f5020b4ffbf3ce67 /drivers
parent76c072b48e39e9291fbf02d6c912cf27d65e093d (diff)
dm: table use list_for_each
This patch is some minor janitorish cleanup, using some macros from linux/list.h (already #included via dm.h) to improve readability. Signed-off-by: Paul Jimenez <pj@place.org> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-table.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 47818d8249cb..d2eb3c593682 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}
@@ -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);