mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 16:44:10 +08:00
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>
This commit is contained in:
parent
76c072b48e
commit
afb24528f9
@ -287,9 +287,8 @@ static void free_devices(struct list_head *devices)
|
|||||||
{
|
{
|
||||||
struct list_head *tmp, *next;
|
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);
|
struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
|
||||||
next = tmp->next;
|
|
||||||
kfree(dd);
|
kfree(dd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -993,12 +992,11 @@ int dm_table_resume_targets(struct dm_table *t)
|
|||||||
|
|
||||||
int dm_table_any_congested(struct dm_table *t, int bdi_bits)
|
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;
|
int r = 0;
|
||||||
|
|
||||||
devices = dm_table_get_devices(t);
|
list_for_each_entry(dd, devices, list) {
|
||||||
for (d = devices->next; d != devices; d = d->next) {
|
|
||||||
struct dm_dev *dd = list_entry(d, struct dm_dev, list);
|
|
||||||
struct request_queue *q = bdev_get_queue(dd->bdev);
|
struct request_queue *q = bdev_get_queue(dd->bdev);
|
||||||
r |= bdi_congested(&q->backing_dev_info, bdi_bits);
|
r |= bdi_congested(&q->backing_dev_info, bdi_bits);
|
||||||
}
|
}
|
||||||
@ -1008,10 +1006,10 @@ int dm_table_any_congested(struct dm_table *t, int bdi_bits)
|
|||||||
|
|
||||||
void dm_table_unplug_all(struct dm_table *t)
|
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) {
|
list_for_each_entry(dd, devices, list) {
|
||||||
struct dm_dev *dd = list_entry(d, struct dm_dev, list);
|
|
||||||
struct request_queue *q = bdev_get_queue(dd->bdev);
|
struct request_queue *q = bdev_get_queue(dd->bdev);
|
||||||
|
|
||||||
blk_unplug(q);
|
blk_unplug(q);
|
||||||
|
Loading…
Reference in New Issue
Block a user