Commit f5f93c0a authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] cleanup + fix bounce end_io handling

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.
parent af942908
...@@ -291,16 +291,12 @@ static inline void copy_to_high_bio_irq(struct bio *to, struct bio *from) ...@@ -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, static void bounce_end_io(struct bio *bio, mempool_t *pool)
int error, mempool_t *pool)
{ {
struct bio *bio_orig = bio->bi_private; struct bio *bio_orig = bio->bi_private;
struct bio_vec *bvec, *org_vec; struct bio_vec *bvec, *org_vec;
int i; int i;
if (bio->bi_size)
return 1;
if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
goto out_eio; goto out_eio;
...@@ -318,43 +314,54 @@ static inline int bounce_end_io(struct bio *bio, unsigned int bytes_done, ...@@ -318,43 +314,54 @@ static inline int bounce_end_io(struct bio *bio, unsigned int bytes_done,
} }
out_eio: out_eio:
bio_endio(bio_orig, bytes_done, error); bio_endio(bio_orig, bio_orig->bi_size, 0);
bio_put(bio); bio_put(bio);
return 0;
} }
static int bounce_end_io_write(struct bio *bio, unsigned int bytes_done, static int bounce_end_io_write(struct bio *bio, unsigned int bytes_done,int err)
int error)
{ {
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, static int bounce_end_io_write_isa(struct bio *bio, unsigned int bytes_done, int err)
int error)
{ {
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, static inline void __bounce_end_io_read(struct bio *bio, mempool_t *pool)
int error, mempool_t *pool)
{ {
struct bio *bio_orig = bio->bi_private; struct bio *bio_orig = bio->bi_private;
if (test_bit(BIO_UPTODATE, &bio->bi_flags)) if (test_bit(BIO_UPTODATE, &bio->bi_flags))
copy_to_high_bio_irq(bio_orig, bio); 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) 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, static int bounce_end_io_read_isa(struct bio *bio, unsigned int bytes_done, int err)
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) void blk_queue_bounce(request_queue_t *q, struct bio **bio_orig)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment