Skip to content

Commit

Permalink
Use list_for_each_entry() instead of list_for_each() in the block device
Browse files Browse the repository at this point in the history
elevator

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Matthias Kaehlcke authored and Jens Axboe committed Jul 10, 2007
1 parent fd11d17 commit 70cee26
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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))
return e;
}
Expand Down Expand Up @@ -1116,14 +1112,11 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name)
{
elevator_t *e = q->elevator;
struct elevator_type *elv = e->elevator_type;
struct list_head *entry;
struct elevator_type *__e;
int len = 0;

spin_lock(&elv_list_lock);
list_for_each(entry, &elv_list) {
struct elevator_type *__e;

__e = list_entry(entry, struct elevator_type, list);
list_for_each_entry(__e, &elv_list, list) {
if (!strcmp(elv->elevator_name, __e->elevator_name))
len += sprintf(name+len, "[%s] ", elv->elevator_name);
else
Expand Down

0 comments on commit 70cee26

Please sign in to comment.