]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] cleanup + fix bounce end_io handling
authorJens Axboe <axboe@suse.de>
Wed, 18 Sep 2002 16:24:40 +0000 (09:24 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 18 Sep 2002 16:24:40 +0000 (09:24 -0700)
Andrew found out that bounce end_io handling did not work for him, so I
fixed the bug (not consistent checking of bi_size). I cleaned it up and
moved the bi_size checking out of bounce_end_io() (the main worker) and
into the individual bi_end_io() handlers instead. Please apply to make
highmem bouncing work again.

mm/highmem.c

index 111e4064d781cadd0acf6e73f618644eb3424026..4e446a09463ebcf00c25d77320dd23abb1091031 100644 (file)
@@ -291,16 +291,12 @@ static inline void copy_to_high_bio_irq(struct bio *to, struct bio *from)
        }
 }
 
-static inline int bounce_end_io(struct bio *bio, unsigned int bytes_done,
-                               int error, mempool_t *pool)
+static void bounce_end_io(struct bio *bio, mempool_t *pool)
 {
        struct bio *bio_orig = bio->bi_private;
        struct bio_vec *bvec, *org_vec;
        int i;
 
-       if (bio->bi_size)
-               return 1;
-
        if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
                goto out_eio;
 
@@ -318,43 +314,54 @@ static inline int bounce_end_io(struct bio *bio, unsigned int bytes_done,
        }
 
 out_eio:
-       bio_endio(bio_orig, bytes_done, error);
+       bio_endio(bio_orig, bio_orig->bi_size, 0);
        bio_put(bio);
-       return 0;
 }
 
-static int bounce_end_io_write(struct bio *bio, unsigned int bytes_done,
-                              int error)
+static int bounce_end_io_write(struct bio *bio, unsigned int bytes_done,int err)
 {
-       return bounce_end_io(bio, bytes_done, error, page_pool);
+       if (bio->bi_size)
+               return 1;
+
+       bounce_end_io(bio, page_pool);
+       return 0;
 }
 
-static int bounce_end_io_write_isa(struct bio *bio, unsigned int bytes_done,
-                                  int error)
+static int bounce_end_io_write_isa(struct bio *bio, unsigned int bytes_done, int err)
 {
-       return bounce_end_io(bio, bytes_done, error, isa_page_pool);
+       if (bio->bi_size)
+               return 1;
+
+       bounce_end_io(bio, isa_page_pool);
+       return 0;
 }
 
-static inline int __bounce_end_io_read(struct bio *bio, unsigned int done,
-                                      int error, mempool_t *pool)
+static inline void __bounce_end_io_read(struct bio *bio, mempool_t *pool)
 {
        struct bio *bio_orig = bio->bi_private;
 
        if (test_bit(BIO_UPTODATE, &bio->bi_flags))
                copy_to_high_bio_irq(bio_orig, bio);
 
-       return bounce_end_io(bio, done, error, pool);
+       bounce_end_io(bio, pool);
 }
 
 static int bounce_end_io_read(struct bio *bio, unsigned int bytes_done, int err)
 {
-       return __bounce_end_io_read(bio, bytes_done, err, page_pool);
+       if (bio->bi_size)
+               return 1;
+
+       __bounce_end_io_read(bio, page_pool);
+       return 0;
 }
 
-static int bounce_end_io_read_isa(struct bio *bio, unsigned int bytes_done,
-                                 int err)
+static int bounce_end_io_read_isa(struct bio *bio, unsigned int bytes_done, int err)
 {
-       return __bounce_end_io_read(bio, bytes_done, err, isa_page_pool);
+       if (bio->bi_size)
+               return 1;
+
+       __bounce_end_io_read(bio, isa_page_pool);
+       return 0;
 }
 
 void blk_queue_bounce(request_queue_t *q, struct bio **bio_orig)