diff options
author | Jun'ichi Nomura <j-nomura@ce.jp.nec.com> | 2012-10-21 21:15:37 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-10-22 16:00:26 -0400 |
commit | 65c77fd9e8a1c8c3da0bbbea6b7efa3d6ef265f8 (patch) | |
tree | 305b08304869b3f8d57a191b4b23968e53b53247 /block/blk-cgroup.c | |
parent | 65635cbc37e011e71b208257a25e7c1078cd039b (diff) |
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 <j-nomura@ce.jp.nec.com>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r-- | block/blk-cgroup.c | 3 |
1 files changed, 3 insertions, 0 deletions
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, | |||
333 | */ | 333 | */ |
334 | if (rl == &q->root_rl) { | 334 | if (rl == &q->root_rl) { |
335 | ent = &q->blkg_list; | 335 | ent = &q->blkg_list; |
336 | /* There are no more block groups, hence no request lists */ | ||
337 | if (list_empty(ent)) | ||
338 | return NULL; | ||
336 | } else { | 339 | } else { |
337 | blkg = container_of(rl, struct blkcg_gq, rl); | 340 | blkg = container_of(rl, struct blkcg_gq, rl); |
338 | ent = &blkg->q_node; | 341 | ent = &blkg->q_node; |