Commit 70cee26e authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Jens Axboe

Use list_for_each_entry() instead of list_for_each() in the block device

elevator
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent fd11d171
...@@ -112,12 +112,8 @@ static inline int elv_try_merge(struct request *__rq, struct bio *bio) ...@@ -112,12 +112,8 @@ static inline int elv_try_merge(struct request *__rq, struct bio *bio)
static struct elevator_type *elevator_find(const char *name) static struct elevator_type *elevator_find(const char *name)
{ {
struct elevator_type *e; struct elevator_type *e;
struct list_head *entry;
list_for_each(entry, &elv_list) {
e = list_entry(entry, struct elevator_type, list);
list_for_each_entry(e, &elv_list, list) {
if (!strcmp(e->elevator_name, name)) if (!strcmp(e->elevator_name, name))
return e; return e;
} }
...@@ -1116,14 +1112,11 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name) ...@@ -1116,14 +1112,11 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name)
{ {
elevator_t *e = q->elevator; elevator_t *e = q->elevator;
struct elevator_type *elv = e->elevator_type; struct elevator_type *elv = e->elevator_type;
struct list_head *entry; struct elevator_type *__e;
int len = 0; int len = 0;
spin_lock(&elv_list_lock); spin_lock(&elv_list_lock);
list_for_each(entry, &elv_list) { list_for_each_entry(__e, &elv_list, list) {
struct elevator_type *__e;
__e = list_entry(entry, struct elevator_type, list);
if (!strcmp(elv->elevator_name, __e->elevator_name)) if (!strcmp(elv->elevator_name, __e->elevator_name))
len += sprintf(name+len, "[%s] ", elv->elevator_name); len += sprintf(name+len, "[%s] ", elv->elevator_name);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment