Commit 14d39718 authored by Jens Axboe's avatar Jens Axboe

Remove nr_sectors from bio_end_io end I/O callback. It was a relic

from when completion was potentially called more than once to indicate
partial end I/O. These days bio->bi_end_io is _only_ called when I/O
has completed on the entire bio.
parent 66c92d06
...@@ -1227,7 +1227,7 @@ static int __make_request(request_queue_t *q, struct bio *bio) ...@@ -1227,7 +1227,7 @@ static int __make_request(request_queue_t *q, struct bio *bio)
return 0; return 0;
end_io: end_io:
bio->bi_end_io(bio, nr_sectors); bio->bi_end_io(bio);
return 0; return 0;
} }
...@@ -1329,7 +1329,7 @@ void generic_make_request(struct bio *bio) ...@@ -1329,7 +1329,7 @@ void generic_make_request(struct bio *bio)
"generic_make_request: Trying to access nonexistent block-device %s (%Lu)\n", "generic_make_request: Trying to access nonexistent block-device %s (%Lu)\n",
kdevname(bio->bi_dev), (long long) bio->bi_sector); kdevname(bio->bi_dev), (long long) bio->bi_sector);
end_io: end_io:
bio->bi_end_io(bio, nr_sectors); bio->bi_end_io(bio);
break; break;
} }
...@@ -1350,15 +1350,12 @@ void generic_make_request(struct bio *bio) ...@@ -1350,15 +1350,12 @@ void generic_make_request(struct bio *bio)
/* /*
* our default bio end_io callback handler for a buffer_head mapping. * our default bio end_io callback handler for a buffer_head mapping.
*/ */
static int end_bio_bh_io_sync(struct bio *bio, int nr_sectors) static void end_bio_bh_io_sync(struct bio *bio)
{ {
struct buffer_head *bh = bio->bi_private; struct buffer_head *bh = bio->bi_private;
BIO_BUG_ON(nr_sectors != (bh->b_size >> 9));
bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags)); bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
bio_put(bio); bio_put(bio);
return 0;
} }
/** /**
...@@ -1641,8 +1638,7 @@ int end_that_request_first(struct request *req, int uptodate, int nr_sectors) ...@@ -1641,8 +1638,7 @@ int end_that_request_first(struct request *req, int uptodate, int nr_sectors)
if (!bio->bi_size) { if (!bio->bi_size) {
req->bio = bio->bi_next; req->bio = bio->bi_next;
if (unlikely(bio_endio(bio, uptodate, total_nsect))) bio_endio(bio, uptodate);
BUG();
total_nsect = 0; total_nsect = 0;
} }
......
...@@ -225,14 +225,12 @@ static void reschedule_retry(r1bio_t *r1_bio) ...@@ -225,14 +225,12 @@ static void reschedule_retry(r1bio_t *r1_bio)
* operation and are ready to return a success/failure code to the buffer * operation and are ready to return a success/failure code to the buffer
* cache layer. * cache layer.
*/ */
static int raid_end_bio_io(r1bio_t *r1_bio, int uptodate, int nr_sectors) static void raid_end_bio_io(r1bio_t *r1_bio, int uptodate)
{ {
struct bio *bio = r1_bio->master_bio; struct bio *bio = r1_bio->master_bio;
bio_endio(bio, uptodate, nr_sectors); bio_endio(bio, uptodate);
free_r1bio(r1_bio); free_r1bio(r1_bio);
return 0;
} }
/* /*
...@@ -247,7 +245,7 @@ static void inline update_head_pos(int disk, r1bio_t *r1_bio) ...@@ -247,7 +245,7 @@ static void inline update_head_pos(int disk, r1bio_t *r1_bio)
atomic_dec(&conf->mirrors[disk].nr_pending); atomic_dec(&conf->mirrors[disk].nr_pending);
} }
static int end_request(struct bio *bio, int nr_sectors) static void end_request(struct bio *bio)
{ {
int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
...@@ -278,8 +276,8 @@ static int end_request(struct bio *bio, int nr_sectors) ...@@ -278,8 +276,8 @@ static int end_request(struct bio *bio, int nr_sectors)
* we have only one bio on the read side * we have only one bio on the read side
*/ */
if (uptodate) { if (uptodate) {
raid_end_bio_io(r1_bio, uptodate, nr_sectors); raid_end_bio_io(r1_bio, uptodate);
return 0; return;
} }
/* /*
* oops, read error: * oops, read error:
...@@ -287,7 +285,7 @@ static int end_request(struct bio *bio, int nr_sectors) ...@@ -287,7 +285,7 @@ static int end_request(struct bio *bio, int nr_sectors)
printk(KERN_ERR "raid1: %s: rescheduling sector %lu\n", printk(KERN_ERR "raid1: %s: rescheduling sector %lu\n",
partition_name(bio->bi_dev), r1_bio->sector); partition_name(bio->bi_dev), r1_bio->sector);
reschedule_retry(r1_bio); reschedule_retry(r1_bio);
return 0; return;
} }
if (r1_bio->read_bio) if (r1_bio->read_bio)
...@@ -307,8 +305,7 @@ static int end_request(struct bio *bio, int nr_sectors) ...@@ -307,8 +305,7 @@ static int end_request(struct bio *bio, int nr_sectors)
* already. * already.
*/ */
if (atomic_dec_and_test(&r1_bio->remaining)) if (atomic_dec_and_test(&r1_bio->remaining))
raid_end_bio_io(r1_bio, uptodate, nr_sectors); raid_end_bio_io(r1_bio, uptodate);
return 0;
} }
/* /*
...@@ -518,7 +515,7 @@ static int make_request(mddev_t *mddev, int rw, struct bio * bio) ...@@ -518,7 +515,7 @@ static int make_request(mddev_t *mddev, int rw, struct bio * bio)
* If all mirrors are non-operational * If all mirrors are non-operational
* then return an IO error: * then return an IO error:
*/ */
raid_end_bio_io(r1_bio, 0, 0); raid_end_bio_io(r1_bio, 0);
return 0; return 0;
} }
atomic_set(&r1_bio->remaining, sum_bios); atomic_set(&r1_bio->remaining, sum_bios);
...@@ -930,7 +927,7 @@ static int diskop(mddev_t *mddev, mdp_disk_t **d, int state) ...@@ -930,7 +927,7 @@ static int diskop(mddev_t *mddev, mdp_disk_t **d, int state)
#define REDIRECT_SECTOR KERN_ERR \ #define REDIRECT_SECTOR KERN_ERR \
"raid1: %s: redirecting sector %lu to another mirror\n" "raid1: %s: redirecting sector %lu to another mirror\n"
static int end_sync_read(struct bio *bio, int nr_sectors) static void end_sync_read(struct bio *bio)
{ {
int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
...@@ -948,11 +945,9 @@ static int end_sync_read(struct bio *bio, int nr_sectors) ...@@ -948,11 +945,9 @@ static int end_sync_read(struct bio *bio, int nr_sectors)
else else
set_bit(R1BIO_Uptodate, &r1_bio->state); set_bit(R1BIO_Uptodate, &r1_bio->state);
reschedule_retry(r1_bio); reschedule_retry(r1_bio);
return 0;
} }
static int end_sync_write(struct bio *bio, int nr_sectors) static void end_sync_write(struct bio *bio)
{ {
int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
...@@ -974,7 +969,6 @@ static int end_sync_write(struct bio *bio, int nr_sectors) ...@@ -974,7 +969,6 @@ static int end_sync_write(struct bio *bio, int nr_sectors)
resume_device(conf); resume_device(conf);
put_buf(r1_bio); put_buf(r1_bio);
} }
return 0;
} }
static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
...@@ -1100,7 +1094,7 @@ static void raid1d(void *data) ...@@ -1100,7 +1094,7 @@ static void raid1d(void *data)
map(mddev, &bio->bi_dev); map(mddev, &bio->bi_dev);
if (kdev_same(bio->bi_dev, dev)) { if (kdev_same(bio->bi_dev, dev)) {
printk(IO_ERROR, partition_name(bio->bi_dev), r1_bio->sector); printk(IO_ERROR, partition_name(bio->bi_dev), r1_bio->sector);
raid_end_bio_io(r1_bio, 0, 0); raid_end_bio_io(r1_bio, 0);
break; break;
} }
printk(REDIRECT_SECTOR, printk(REDIRECT_SECTOR,
......
...@@ -316,13 +316,12 @@ struct bio *bio_copy(struct bio *bio, int gfp_mask, int copy) ...@@ -316,13 +316,12 @@ struct bio *bio_copy(struct bio *bio, int gfp_mask, int copy)
return NULL; return NULL;
} }
static int bio_end_io_kio(struct bio *bio, int nr_sectors) static void bio_end_io_kio(struct bio *bio)
{ {
struct kiobuf *kio = (struct kiobuf *) bio->bi_private; struct kiobuf *kio = (struct kiobuf *) bio->bi_private;
end_kio_request(kio, test_bit(BIO_UPTODATE, &bio->bi_flags)); end_kio_request(kio, test_bit(BIO_UPTODATE, &bio->bi_flags));
bio_put(bio); bio_put(bio);
return 0;
} }
/** /**
...@@ -441,7 +440,7 @@ void ll_rw_kio(int rw, struct kiobuf *kio, kdev_t dev, sector_t sector) ...@@ -441,7 +440,7 @@ void ll_rw_kio(int rw, struct kiobuf *kio, kdev_t dev, sector_t sector)
end_kio_request(kio, !err); end_kio_request(kio, !err);
} }
int bio_endio(struct bio *bio, int uptodate, int nr_sectors) void bio_endio(struct bio *bio, int uptodate)
{ {
if (uptodate) if (uptodate)
set_bit(BIO_UPTODATE, &bio->bi_flags); set_bit(BIO_UPTODATE, &bio->bi_flags);
...@@ -449,9 +448,7 @@ int bio_endio(struct bio *bio, int uptodate, int nr_sectors) ...@@ -449,9 +448,7 @@ int bio_endio(struct bio *bio, int uptodate, int nr_sectors)
clear_bit(BIO_UPTODATE, &bio->bi_flags); clear_bit(BIO_UPTODATE, &bio->bi_flags);
if (bio->bi_end_io) if (bio->bi_end_io)
return bio->bi_end_io(bio, nr_sectors); bio->bi_end_io(bio);
return 0;
} }
static void __init biovec_init_pool(void) static void __init biovec_init_pool(void)
......
...@@ -50,7 +50,7 @@ struct bio_vec { ...@@ -50,7 +50,7 @@ struct bio_vec {
* weee, c forward decl... * weee, c forward decl...
*/ */
struct bio; struct bio;
typedef int (bio_end_io_t) (struct bio *, int); typedef void (bio_end_io_t) (struct bio *);
typedef void (bio_destructor_t) (struct bio *); typedef void (bio_destructor_t) (struct bio *);
/* /*
...@@ -159,7 +159,7 @@ struct bio { ...@@ -159,7 +159,7 @@ struct bio {
#define BIO_SEG_BOUNDARY(q, b1, b2) \ #define BIO_SEG_BOUNDARY(q, b1, b2) \
BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2))) BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
#define bio_io_error(bio) bio_endio((bio), 0, bio_sectors((bio))) #define bio_io_error(bio) bio_endio((bio), 0)
/* /*
* drivers should not use the __ version unless they _really_ want to * drivers should not use the __ version unless they _really_ want to
...@@ -192,7 +192,7 @@ struct bio { ...@@ -192,7 +192,7 @@ struct bio {
extern struct bio *bio_alloc(int, int); extern struct bio *bio_alloc(int, int);
extern void bio_put(struct bio *); extern void bio_put(struct bio *);
extern int bio_endio(struct bio *, int, int); extern void bio_endio(struct bio *, int);
struct request_queue; struct request_queue;
extern inline int bio_phys_segments(struct request_queue *, struct bio *); extern inline int bio_phys_segments(struct request_queue *, struct bio *);
extern inline int bio_hw_segments(struct request_queue *, struct bio *); extern inline int bio_hw_segments(struct request_queue *, struct bio *);
......
...@@ -288,11 +288,11 @@ static inline void copy_to_high_bio_irq(struct bio *to, struct bio *from) ...@@ -288,11 +288,11 @@ static inline void copy_to_high_bio_irq(struct bio *to, struct bio *from)
} }
} }
static inline int bounce_end_io (struct bio *bio, int nr_sectors, mempool_t *pool) static inline void bounce_end_io(struct bio *bio, 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 ret, i; int i;
if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
goto out_eio; goto out_eio;
...@@ -311,41 +311,38 @@ static inline int bounce_end_io (struct bio *bio, int nr_sectors, mempool_t *poo ...@@ -311,41 +311,38 @@ static inline int bounce_end_io (struct bio *bio, int nr_sectors, mempool_t *poo
} }
out_eio: out_eio:
ret = bio_orig->bi_end_io(bio_orig, nr_sectors); bio_orig->bi_end_io(bio_orig);
bio_put(bio); bio_put(bio);
return ret;
} }
static int bounce_end_io_write(struct bio *bio, int nr_sectors) static void bounce_end_io_write(struct bio *bio)
{ {
return bounce_end_io(bio, nr_sectors, page_pool); bounce_end_io(bio, page_pool);
} }
static int bounce_end_io_write_isa(struct bio *bio, int nr_sectors) static void bounce_end_io_write_isa(struct bio *bio)
{ {
return bounce_end_io(bio, nr_sectors, isa_page_pool); bounce_end_io(bio, isa_page_pool);
} }
static inline int __bounce_end_io_read(struct bio *bio, int nr_sectors, static inline void __bounce_end_io_read(struct bio *bio, mempool_t *pool)
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, nr_sectors, pool); bounce_end_io(bio, pool);
} }
static int bounce_end_io_read(struct bio *bio, int nr_sectors) static void bounce_end_io_read(struct bio *bio)
{ {
return __bounce_end_io_read(bio, nr_sectors, page_pool); __bounce_end_io_read(bio, page_pool);
} }
static int bounce_end_io_read_isa(struct bio *bio, int nr_sectors) static void bounce_end_io_read_isa(struct bio *bio)
{ {
return __bounce_end_io_read(bio, nr_sectors, isa_page_pool); return __bounce_end_io_read(bio, isa_page_pool);
} }
void create_bounce(unsigned long pfn, int gfp, struct bio **bio_orig) void create_bounce(unsigned long pfn, int gfp, 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