Re: [PATCH] loop: use BIO list management functions

From: Christoph Hellwig
Date: Fri Apr 17 2009 - 02:37:25 EST


On Fri, Apr 17, 2009 at 03:32:17PM +0900, Akinobu Mita wrote:
> Impact: cleanup

I though we had pretty broad agreement that these lines are utter crap?
:)

> static void loop_add_bio(struct loop_device *lo, struct bio *bio)
> {
> - if (lo->lo_biotail) {
> - lo->lo_biotail->bi_next = bio;
> - lo->lo_biotail = bio;
> - } else
> - lo->lo_bio = lo->lo_biotail = bio;
> + bio_list_add(&lo->lo_bio_list, bio);
> }

This function only has one caller, no need to keep it.

> static struct bio *loop_get_bio(struct loop_device *lo)
> {
> - struct bio *bio;
> -
> - if ((bio = lo->lo_bio)) {
> - if (bio == lo->lo_biotail)
> - lo->lo_biotail = NULL;
> - lo->lo_bio = bio->bi_next;
> - bio->bi_next = NULL;
> - }
> -
> - return bio;
> + return bio_list_pop(&lo->lo_bio_list);
> }

Same here.

> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -505,7 +505,7 @@ static inline int bio_has_data(struct bio *bio)
> }
>
> /*
> - * BIO list managment for use by remapping drivers (e.g. DM or MD).
> + * BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
> *


I don't think this needs changing, that was just examples.


--
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/