From: Jun'ichi Nomura Date: Mon, 22 Oct 2012 01:15:37 +0000 (+0900) Subject: blkcg: stop iteration early if root_rl is the only request list X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=65c77fd9e8a1c8c3da0bbbea6b7efa3d6ef265f8;p=linux-beck.git blkcg: stop iteration early if root_rl is the only request list __blk_queue_next_rl() finds next request list based on blkg_list while skipping root_blkg in the list. OTOH, root_rl is special as it may exist even without root_blkg. Though the later part of the function handles such a case correctly, exiting early is good for readability of the code. Signed-off-by: Jun'ichi Nomura Cc: Tejun Heo Acked-by: Vivek Goyal Signed-off-by: Jens Axboe --- diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 3ad5e3fbf579..d0b770391ad4 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -333,6 +333,9 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl, */ if (rl == &q->root_rl) { ent = &q->blkg_list; + /* There are no more block groups, hence no request lists */ + if (list_empty(ent)) + return NULL; } else { blkg = container_of(rl, struct blkcg_gq, rl); ent = &blkg->q_node;