mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corrado Zoccolo <czoccolo@gmail.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>,
	Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [RFC PATCH 1/5] cfq-iosched: adapt slice to number of processes  doing I/O
Date: Tue, 20 Oct 2009 20:11:19 +0200	[thread overview]
Message-ID: <4e5e476b0910201111l21ca6574qd5eb3ac2ab089052@mail.gmail.com> (raw)
In-Reply-To: <20091020131744.GH10727@kernel.dk>

On Tue, Oct 20, 2009 at 3:17 PM, Jens Axboe <jens.axboe@oracle.com> 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@gmail.com
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

      reply	other threads:[~2009-10-20 18:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 20:21 Corrado Zoccolo
2009-10-20  0:54 ` Jens Axboe
2009-10-20 10:01   ` Corrado Zoccolo
2009-10-20 13:17     ` Jens Axboe
2009-10-20 18:11       ` Corrado Zoccolo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e5e476b0910201111l21ca6574qd5eb3ac2ab089052@mail.gmail.com \
    --to=czoccolo@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®