[dm-devel] [RFC][PATCH 1/2] bio queue functions in dm-bio-list.h

Christophe Saout christophe at saout.de
Mon Jan 19 15:27:01 UTC 2004


Am Mo, den 12.01.2004 schrieb Kevin Corry um 16:26:

> > I found some bio_list functions in dm-raid1.c and I thought they could
> > be made available for other users too. 
> 
> > There's probably a better place for this.
> 
> Heh...maybe include/linux/bio.h? :)

Yes, perhaps. There are a lot of places in the rest of the kernel where
this might be useful (a grep shows that bi_next is used 76 times).

Probably someone is going to complain when the code is pushed into the
kernel. :)

> Now that you've pointed out this stack vs. fifo problem a couple times, I'm 
> beginning to wonder why the bi_next field in the bio is a struct bio * 
> instead of a struct list_head.

To save some bytes? ;)

Probably because nobody wants to needs the list backwards. The elevator
only keeps track of head and tail (to merge requests) and walks the list
in one direction (or a driver).

> Of course, it's probably way to late to make this kind of change, since it 
> would involve auditing every driver that ever holds a pointer to a bio to see 
> if it's treating that pointer as the head of a list.

As I said, 70 occurences of bi_next in the kernel. A lot under
/drivers/md, the elevator, bio.c setting it to NULL, the network block
device, ide-scsi, the loop driver, the umem driver, the cciss and
cpqarray driver (is setting bi_next to NULL? This looks strange or
possibly broken), the rest just walks the list (some ugly uses in ide
code and the generic walking code in blkdev.h).

So it shouldn't be too much work if there would be an agreement to
change this.






More information about the dm-devel mailing list