lkml.org 
[lkml]   [2015]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/8] cfq-iosched: simplify control flow in cfq_get_queue()
Date
Tejun Heo <tj@kernel.org> writes:

> cfq_get_queue()'s control flow looks like the following.
>
> async_cfqq = NULL;
> cfqq = NULL;
>
> if (!is_sync) {
> ...
> async_cfqq = ...;
> cfqq = *async_cfqq;
> }
>
> if (!cfqq)
> cfqq = ...;
>
> if (!is_sync && !(*async_cfqq))
> ...;
>
> The only thing the local variable init, the second if, and the
> async_cfqq test in the third if achieves is to skip cfqq creation and
> installation if *async_cfqq was already non-NULL. This is needlessly
> complicated with different tests examining the same condition.
> Simplify it to the following.
>
> if (!is_sync) {
> ...
> async_cfqq = ...;
> cfqq = *async_cfqq;
> if (cfqq)
> goto out;
> }
>
> cfqq = ...;
>
> if (!is_sync)
> ...;
> out:
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> Cc: Arianna Avanzini <avanzini.arianna@gmail.com>

Acked-by: Jeff Moyer <jmoyer@redhat.com>


\
 
 \ /
  Last update: 2015-06-08 21:01    [W:0.144 / U:0.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site