# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.821 -> 1.822 # drivers/block/ll_rw_blk.c 1.129 -> 1.130 # fs/bio.c 1.32 -> 1.33 # include/linux/bio.h 1.23 -> 1.24 # drivers/block/umem.c 1.25 -> 1.26 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/10/28 axboe@burns.home.kernel.dk 1.822 # Make bio->bi_end_io optional # -------------------------------------------- # diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c --- a/drivers/block/ll_rw_blk.c Mon Oct 28 18:46:11 2002 +++ b/drivers/block/ll_rw_blk.c Mon Oct 28 18:46:11 2002 @@ -1941,7 +1941,6 @@ { int count = bio_sectors(bio); - BUG_ON(!bio->bi_end_io); BIO_BUG_ON(!bio->bi_size); BIO_BUG_ON(!bio->bi_io_vec); bio->bi_rw = rw; diff -Nru a/drivers/block/umem.c b/drivers/block/umem.c --- a/drivers/block/umem.c Mon Oct 28 18:46:11 2002 +++ b/drivers/block/umem.c Mon Oct 28 18:46:11 2002 @@ -548,12 +548,7 @@ return_bio = bio->bi_next; bio->bi_next = NULL; - /* should use bio_endio(), however already cleared - * BIO_UPTODATE. so set bio->bi_size = 0 manually to indicate - * completely done - */ - bio->bi_size = 0; - bio->bi_end_io(bio, bytes, 0); + bio_endio(bio, bio->bi_size, 0); } } diff -Nru a/fs/bio.c b/fs/bio.c --- a/fs/bio.c Mon Oct 28 18:46:11 2002 +++ b/fs/bio.c Mon Oct 28 18:46:11 2002 @@ -122,6 +122,7 @@ bio->bi_max_vecs = 0; bio->bi_end_io = NULL; atomic_set(&bio->bi_cnt, 1); + bio->bi_private = NULL; } /** @@ -452,14 +453,15 @@ * @error: error, if any * * Description: - * bio_endio() will end I/O @bytes_done number of bytes. This may be just - * a partial part of the bio, or it may be the whole bio. bio_endio() is - * the preferred way to end I/O on a bio, it takes care of decrementing + * bio_endio() will end I/O on @bytes_done number of bytes. This may be + * just a partial part of the bio, or it may be the whole bio. bio_endio() + * is the preferred way to end I/O on a bio, it takes care of decrementing * bi_size and clearing BIO_UPTODATE on error. @error is 0 on success, and * and one of the established -Exxxx (-EIO, for instance) error values in - * case something went wrong. + * case something went wrong. Noone should call bi_end_io() directly on + * a bio unless they own it and thus know that it has an end_io function. **/ -int bio_endio(struct bio *bio, unsigned int bytes_done, int error) +void bio_endio(struct bio *bio, unsigned int bytes_done, int error) { if (error) clear_bit(BIO_UPTODATE, &bio->bi_flags); @@ -471,7 +473,9 @@ } bio->bi_size -= bytes_done; - return bio->bi_end_io(bio, bytes_done, error); + + if (bio->bi_end_io) + bio->bi_end_io(bio, bytes_done, error); } static void __init biovec_init_pools(void) @@ -543,7 +547,7 @@ return 0; } -module_init(init_bio); +subsys_initcall(init_bio); EXPORT_SYMBOL(bio_alloc); EXPORT_SYMBOL(bio_put); diff -Nru a/include/linux/bio.h b/include/linux/bio.h --- a/include/linux/bio.h Mon Oct 28 18:46:11 2002 +++ b/include/linux/bio.h Mon Oct 28 18:46:11 2002 @@ -202,7 +202,7 @@ extern struct bio *bio_alloc(int, int); extern void bio_put(struct bio *); -extern int bio_endio(struct bio *, unsigned int, int); +extern void bio_endio(struct bio *, unsigned int, int); struct request_queue; extern inline int bio_phys_segments(struct request_queue *, struct bio *); extern inline int bio_hw_segments(struct request_queue *, struct bio *);