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)
return 0;
end_io:
bio->bi_end_io(bio, nr_sectors);
bio->bi_end_io(bio);
return 0;
}
......@@ -1329,7 +1329,7 @@ void generic_make_request(struct bio *bio)
"generic_make_request: Trying to access nonexistent block-device %s (%Lu)\n",
kdevname(bio->bi_dev), (long long) bio->bi_sector);
end_io:
bio->bi_end_io(bio, nr_sectors);
bio->bi_end_io(bio);
break;
}
......@@ -1350,15 +1350,12 @@ void generic_make_request(struct bio *bio)
/*
* 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;
BIO_BUG_ON(nr_sectors != (bh->b_size >> 9));
bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
bio_put(bio);
return 0;
}
/**
......@@ -1641,8 +1638,7 @@ int end_that_request_first(struct request *req, int uptodate, int nr_sectors)
if (!bio->bi_size) {
req->bio = bio->bi_next;
if (unlikely(bio_endio(bio, uptodate, total_nsect)))
BUG();
bio_endio(bio, uptodate);
total_nsect = 0;
}
......
......@@ -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
* 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;
bio_endio(bio, uptodate, nr_sectors);
bio_endio(bio, uptodate);
free_r1bio(r1_bio);
return 0;
}
/*
......@@ -247,7 +245,7 @@ static void inline update_head_pos(int disk, r1bio_t *r1_bio)
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);
r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
......@@ -278,8 +276,8 @@ static int end_request(struct bio *bio, int nr_sectors)
* we have only one bio on the read side
*/
if (uptodate) {
raid_end_bio_io(r1_bio, uptodate, nr_sectors);
return 0;
raid_end_bio_io(r1_bio, uptodate);
return;
}
/*
* oops, read error:
......@@ -287,7 +285,7 @@ static int end_request(struct bio *bio, int nr_sectors)
printk(KERN_ERR "raid1: %s: rescheduling sector %lu\n",
partition_name(bio->bi_dev), r1_bio->sector);
reschedule_retry(r1_bio);
return 0;
return;
}
if (r1_bio->read_bio)
......@@ -307,8 +305,7 @@ static int end_request(struct bio *bio, int nr_sectors)
* already.
*/
if (atomic_dec_and_test(&r1_bio->remaining))
raid_end_bio_io(r1_bio, uptodate, nr_sectors);
return 0;
raid_end_bio_io(r1_bio, uptodate);
}
/*
......@@ -518,7 +515,7 @@ static int make_request(mddev_t *mddev, int rw, struct bio * bio)
* If all mirrors are non-operational
* then return an IO error:
*/
raid_end_bio_io(r1_bio, 0, 0);
raid_end_bio_io(r1_bio, 0);
return 0;
}
atomic_set(&r1_bio->remaining, sum_bios);
......@@ -930,7 +927,7 @@ static int diskop(mddev_t *mddev, mdp_disk_t **d, int state)
#define REDIRECT_SECTOR KERN_ERR \
"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);
r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
......@@ -948,11 +945,9 @@ static int end_sync_read(struct bio *bio, int nr_sectors)
else
set_bit(R1BIO_Uptodate, &r1_bio->state);
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);
r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private);
......@@ -974,7 +969,6 @@ static int end_sync_write(struct bio *bio, int nr_sectors)
resume_device(conf);
put_buf(r1_bio);
}
return 0;
}
static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
......@@ -1100,7 +1094,7 @@ static void raid1d(void *data)
map(mddev, &bio->bi_dev);
if (kdev_same(bio->bi_dev, dev)) {
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;
}
printk(REDIRECT_SECTOR,
......
......@@ -316,13 +316,12 @@ struct bio *bio_copy(struct bio *bio, int gfp_mask, int copy)
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;
end_kio_request(kio, test_bit(BIO_UPTODATE, &bio->bi_flags));
bio_put(bio);
return 0;
}
/**
......@@ -441,7 +440,7 @@ void ll_rw_kio(int rw, struct kiobuf *kio, kdev_t dev, sector_t sector)
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)
set_bit(BIO_UPTODATE, &bio->bi_flags);
......@@ -449,9 +448,7 @@ int bio_endio(struct bio *bio, int uptodate, int nr_sectors)
clear_bit(BIO_UPTODATE, &bio->bi_flags);
if (bio->bi_end_io)
return bio->bi_end_io(bio, nr_sectors);
return 0;
bio->bi_end_io(bio);
}
static void __init biovec_init_pool(void)
......
......@@ -50,7 +50,7 @@ struct bio_vec {
* weee, c forward decl...
*/
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 *);
/*
......@@ -159,7 +159,7 @@ struct bio {
#define BIO_SEG_BOUNDARY(q, b1, 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
......@@ -192,7 +192,7 @@ struct bio {
extern struct bio *bio_alloc(int, int);
extern void bio_put(struct bio *);
extern int bio_endio(struct bio *, int, int);
extern void bio_endio(struct bio *, 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 *);
......
......@@ -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_vec *bvec, *org_vec;
int ret, i;
int i;
if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
goto out_eio;
......@@ -311,41 +311,38 @@ static inline int bounce_end_io (struct bio *bio, int nr_sectors, mempool_t *poo
}
out_eio:
ret = bio_orig->bi_end_io(bio_orig, nr_sectors);
bio_orig->bi_end_io(bio_orig);
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,
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, 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)
......
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