From: Kevin Corry <kevcorry@us.ibm.com>
To: dm-devel@sistina.com, Christophe Saout <christophe@saout.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [dm-devel] [RFC][PATCH 1/2] bio queue functions in dm-bio-list.h
Date: Mon, 12 Jan 2004 09:26:11 -0600 [thread overview]
Message-ID: <200401120926.11404.kevcorry@us.ibm.com> (raw)
In-Reply-To: <20040110200848.GB11068@leto.cs.pocnet.net>
On Saturday 10 January 2004 14:08, Christophe Saout wrote:
> Hi,
>
> 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? :)
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. It would seem that changing it to a list_head
would eliminate the need for the bio_list stuff, as well as eliminate the
original problem of accidentally reordering the bio's.
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.
> --- linux.orig/drivers/md/dm-bio-list.h 1970-01-01 01:00:00.000000000 +0100
> +++ linux/drivers/md/dm-bio-list.h 2004-01-10 20:43:32.442353960 +0100
> @@ -0,0 +1,70 @@
> +/*
> + * bio queue functions
> + *
> + * Copyright (C) 2001, 2002 Sistina Software
> + *
> + * This file is released under the LGPL.
> + */
> +
> +#ifndef DM_BIO_LIST_H
> +#define DM_BIO_LIST_H
> +
> +#include <linux/bio.h>
> +
> +struct bio_list {
> + struct bio *head;
> + struct bio *tail;
> +};
> +
> +extern inline void bio_list_init(struct bio_list *bl)
> +{
> + bl->head = bl->tail = NULL;
> +}
> +
> +extern inline void bio_list_add(struct bio_list *bl, struct bio *bio)
> +{
> + bio->bi_next = NULL;
> +
> + if (bl->tail)
> + bl->tail->bi_next = bio;
> + else
> + bl->head = bio;
> +
> + bl->tail = bio;
> +}
> +
> +extern inline void bio_list_merge(struct bio_list *bl, struct bio_list
> *bl2) +{
> + if (bl->tail)
> + bl->tail->bi_next = bl2->head;
> + else
> + bl->head = bl2->head;
> +
> + bl->tail = bl2->tail;
> +}
> +
> +extern inline struct bio *bio_list_pop(struct bio_list *bl)
> +{
> + struct bio *bio = bl->head;
> +
> + if (bio) {
> + bl->head = bl->head->bi_next;
> + if (!bl->head)
> + bl->tail = NULL;
> +
> + bio->bi_next = NULL;
> + }
> +
> + return bio;
> +}
> +
> +extern inline struct bio *bio_list_get(struct bio_list *bl)
> +{
> + struct bio *bio = bl->head;
> +
> + bl->head = bl->tail = NULL;
> +
> + return bio;
> +}
> +
> +#endif
--
Kevin Corry
kevcorry@us.ibm.com
http://evms.sourceforge.net/
parent reply other threads:[~2004-01-12 15:28 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20040110200848.GB11068@leto.cs.pocnet.net>]
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=200401120926.11404.kevcorry@us.ibm.com \
--to=kevcorry@us.ibm.com \
--cc=christophe@saout.de \
--cc=dm-devel@sistina.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