All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	hch@lst.de
Subject: Re: [PATCH 0/2] Putting bio_list into struct request?
Date: Sun, 19 Apr 2009 19:44:59 +0200	[thread overview]
Message-ID: <20090419174459.GL4593@kernel.dk> (raw)
In-Reply-To: <20090419161234.GA12105@havoc.gtf.org>

On Sun, Apr 19 2009, Jeff Garzik wrote:
> 
> Now that we have bio_list in include/linux/bio.h, I wanted to see what
> would happen when I replaced rq->{bio,biotail} with rq->bio_list.
> 
> Personally, I think the result is more readable, and indicates to all
> users that rq->bio is really a list (even if a list with one entry).
> Also, it highlights some bio users in downstream drivers, and hopefully
> serves to increase the amount of bio-related review in those drivers.

Well, I disagree, but perhaps I'm just used to it... Plus the patch
actually adds more lines than it deletes, and the resulting code is
larger. I think that's a pretty good hint not to use helpers, at least
for core code. It's more important in drivers, where we want
easy-to-use and understand helpers, since it minimizes bugs in code
written by people who may not be intimate with the block layer etc.

> The first patch is a straightforward replacement, with no code or
> behavior changes (any such is a bug in the patch...):
> 
> 	- null/not-null tests become bio_list_empty()
> 	- rq->bio becomes rq->bio_list.head
> 	- rq->biotail becomes rq->bio_list.tail
> 	- in a few cases, bio_list_xxx functions are called
> 	  as appropriate
> 
> The second patch are fixes to what I believe are minor bugs in the
> bio-list-aware block core.  Even if patch #1 is not accepted, these
> fixes are likely needed regardless.  Typically the bugs are of the type
> "we forgot to update rq->biotail".

It's not bugs, as soon as you clear ->bio there's no list to begin with.
->biotail is only ever used for back merging checks. If we didn't do
back merging, we would not need to access the tail element ever. I
suspect the reason why the resulting code is larger is exactly because
it's not a 1:1 transition. When we do a back merge, we don't have to
check of ->tail is set. It always is.

-- 
Jens Axboe


      parent reply	other threads:[~2009-04-19 17:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-19 16:12 [PATCH 0/2] Putting bio_list into struct request? Jeff Garzik
2009-04-19 16:13 ` [PATCH 1/2] Update struct request to use bio_list Jeff Garzik
2009-04-19 16:14 ` [PATCH 2/2] Fix bugs found during bio_list update Jeff Garzik
2009-04-19 17:44 ` Jens Axboe [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=20090419174459.GL4593@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=hch@lst.de \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.