Re: [RFC PATCH 1/5] cfq-iosched: adapt slice to number of processes doing I/O

From: Corrado Zoccolo
Date: Tue Oct 20 2009 - 14:11:26 EST


On Tue, Oct 20, 2009 at 3:17 PM, Jens Axboe <jens.axboe@xxxxxxxxxx> wrote:
> I do, personally it doesn't read anywhere near as naturally as a simple
> 'if'. And when you start doing x = a ? b : c ? d : e; I almost reach for
> the nearest expletive :-)
In this case, formatting it on multiple lines could help:
a ? b :
c ? d :
e;
>
> And adding a local scope with {} and having 3-4 broken lines of
> multiplications, divisions (etc) inside max()/min() calls doesn't add to
> the readability in any positive way...

Ok, but min and max hide a lot of complexity for the corner cases.
Espressing those with plain ifs would be really a tough task.

>
>> To me, it seems a good way to achieve a different readability goal,
>> i.e. define the value of a variable in a single place, instead of
>> scattering it around on multiple lines.
>
> I prefer putting it elsewhere instead. So instead of doing:
>
> Â Â Â Âfoo_type bar = x(y) == BAZ ? a : b;
>
> you have
>
> get_foo_type(y)
> {
> Â Â Â Âif (x(y) == BAZ)
> Â Â Â Â Â Â Â Âreturn a;
>
> Â Â Â Âreturn b;
> }
>
> Â Â Â Âfoo_type bar = get_foo_type(y);
>
> which is a lot more readable to me. Especially since you have to do the
> get_foo_type() operation in a lot of places.

Sounds good. I'll do in this way in next version.

>
>> It's not important for the patches per se, but I found odd (and it
>> caused me some headache while debugging) that in cfq_add_rq_rb the
>> fifo was still empty.
>> In the new form, the rq will be complete when added, while in the
>> previous, it still had some empty fields.
>
> Then keep it like it is, or do it as a separate patch. When you include
> it in a functionally changing patch like this, I'm assuming there must
> be a reason for that. And when it seems like there isn't, you wonder
> what is up.

I'm moving it in the preparation patch, that is not changing
functionality. There,. it makes more sense.

I'm going to send the revised series soon.

Corrado
>
> --
> Jens Axboe
>
>



--
__________________________________________________________________________

dott. Corrado Zoccolo mailto:czoccolo@xxxxxxxxx
PhD - Department of Computer Science - University of Pisa, Italy
--------------------------------------------------------------------------
The self-confidence of a warrior is not the self-confidence of the average
man. The average man seeks certainty in the eyes of the onlooker and calls
that self-confidence. The warrior seeks impeccability in his own eyes and
calls that humbleness.
Tales of Power - C. Castaneda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/