aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-09-27 06:47:43 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 03:25:57 -0400
commit6712ecf8f648118c3363c142196418f89a510b90 (patch)
tree347d39a7d5a7ed96d3b1afecd28de2a0f98b98c9 /fs
parent5bb23a688b2de23d7765a1dd439d89c038378978 (diff)
Drop 'size' argument from bio_endio and bi_end_io
As bi_end_io is only called once when the reqeust is complete, the 'size' argument is now redundant. Remove it. Now there is no need for bio_endio to subtract the size completed from bi_size. So don't do that either. While we are at it, change bi_end_io to return void. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bio.c35
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/buffer.c6
-rw-r--r--fs/direct-io.c13
-rw-r--r--fs/gfs2/super.c4
-rw-r--r--fs/jfs/jfs_logmgr.c5
-rw-r--r--fs/jfs/jfs_metapage.c12
-rw-r--r--fs/mpage.c12
-rw-r--r--fs/ocfs2/cluster/heartbeat.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c4
11 files changed, 17 insertions, 84 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 3adecd64ff6e..5f604f269dfa 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -798,13 +798,9 @@ void bio_unmap_user(struct bio *bio)
798 bio_put(bio); 798 bio_put(bio);
799} 799}
800 800
801static int bio_map_kern_endio(struct bio *bio, unsigned int bytes_done, int err) 801static void bio_map_kern_endio(struct bio *bio, int err)
802{ 802{
803 if (bio->bi_size)
804 return 1;
805
806 bio_put(bio); 803 bio_put(bio);
807 return 0;
808} 804}
809 805
810 806
@@ -1002,12 +998,10 @@ void bio_check_pages_dirty(struct bio *bio)
1002/** 998/**
1003 * bio_endio - end I/O on a bio 999 * bio_endio - end I/O on a bio
1004 * @bio: bio 1000 * @bio: bio
1005 * @bytes_done: number of bytes completed
1006 * @error: error, if any 1001 * @error: error, if any
1007 * 1002 *
1008 * Description: 1003 * Description:
1009 * bio_endio() will end I/O on @bytes_done number of bytes. This 1004 * bio_endio() will end I/O on the whole bio. bio_endio() is the
1010 * must always be the whole (remaining) bio. bio_endio() is the
1011 * preferred way to end I/O on a bio, it takes care of clearing 1005 * preferred way to end I/O on a bio, it takes care of clearing
1012 * BIO_UPTODATE on error. @error is 0 on success, and and one of the 1006 * BIO_UPTODATE on error. @error is 0 on success, and and one of the
1013 * established -Exxxx (-EIO, for instance) error values in case 1007 * established -Exxxx (-EIO, for instance) error values in case
@@ -1015,22 +1009,15 @@ void bio_check_pages_dirty(struct bio *bio)
1015 * bio unless they own it and thus know that it has an end_io 1009 * bio unless they own it and thus know that it has an end_io
1016 * function. 1010 * function.
1017 **/ 1011 **/
1018void bio_endio(struct bio *bio, unsigned int bytes_done, int error) 1012void bio_endio(struct bio *bio, int error)
1019{ 1013{
1020 if (error) 1014 if (error)
1021 clear_bit(BIO_UPTODATE, &bio->bi_flags); 1015 clear_bit(BIO_UPTODATE, &bio->bi_flags);
1022 else if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) 1016 else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
1023 error = -EIO; 1017 error = -EIO;
1024 1018
1025 if (unlikely(bytes_done != bio->bi_size)) {
1026 printk("%s: want %u bytes done, only %u left\n", __FUNCTION__,
1027 bytes_done, bio->bi_size);
1028 bytes_done = bio->bi_size;
1029 }
1030
1031 bio->bi_size = 0; /* expected by some callees - will be removed */
1032 if (bio->bi_end_io) 1019 if (bio->bi_end_io)
1033 bio->bi_end_io(bio, bytes_done, error); 1020 bio->bi_end_io(bio, error);
1034} 1021}
1035 1022
1036void bio_pair_release(struct bio_pair *bp) 1023void bio_pair_release(struct bio_pair *bp)
@@ -1038,37 +1025,29 @@ void bio_pair_release(struct bio_pair *bp)
1038 if (atomic_dec_and_test(&bp->cnt)) { 1025 if (atomic_dec_and_test(&bp->cnt)) {
1039 struct bio *master = bp->bio1.bi_private; 1026 struct bio *master = bp->bio1.bi_private;
1040 1027
1041 bio_endio(master, master->bi_size, bp->error); 1028 bio_endio(master, bp->error);
1042 mempool_free(bp, bp->bio2.bi_private); 1029 mempool_free(bp, bp->bio2.bi_private);
1043 } 1030 }
1044} 1031}
1045 1032
1046static int bio_pair_end_1(struct bio * bi, unsigned int done, int err) 1033static void bio_pair_end_1(struct bio *bi, int err)
1047{ 1034{
1048 struct bio_pair *bp = container_of(bi, struct bio_pair, bio1); 1035 struct bio_pair *bp = container_of(bi, struct bio_pair, bio1);
1049 1036
1050 if (err) 1037 if (err)
1051 bp->error = err; 1038 bp->error = err;
1052 1039
1053 if (bi->bi_size)
1054 return 1;
1055
1056 bio_pair_release(bp); 1040 bio_pair_release(bp);
1057 return 0;
1058} 1041}
1059 1042
1060static int bio_pair_end_2(struct bio * bi, unsigned int done, int err) 1043static void bio_pair_end_2(struct bio *bi, int err)
1061{ 1044{
1062 struct bio_pair *bp = container_of(bi, struct bio_pair, bio2); 1045 struct bio_pair *bp = container_of(bi, struct bio_pair, bio2);
1063 1046
1064 if (err) 1047 if (err)
1065 bp->error = err; 1048 bp->error = err;
1066 1049
1067 if (bi->bi_size)
1068 return 1;
1069
1070 bio_pair_release(bp); 1050 bio_pair_release(bp);
1071 return 0;
1072} 1051}
1073 1052
1074/* 1053/*
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 2980eabe5779..6339a30879b7 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -172,7 +172,7 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
172} 172}
173 173
174#if 0 174#if 0
175static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error) 175static void blk_end_aio(struct bio *bio, int error)
176{ 176{
177 struct kiocb *iocb = bio->bi_private; 177 struct kiocb *iocb = bio->bi_private;
178 atomic_t *bio_count = &iocb->ki_bio_count; 178 atomic_t *bio_count = &iocb->ki_bio_count;
diff --git a/fs/buffer.c b/fs/buffer.c
index 0e5ec371ce72..75b51dfa5e03 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2634,13 +2634,10 @@ sector_t generic_block_bmap(struct address_space *mapping, sector_t block,
2634 return tmp.b_blocknr; 2634 return tmp.b_blocknr;
2635} 2635}
2636 2636
2637static int end_bio_bh_io_sync(struct bio *bio, unsigned int bytes_done, int err) 2637static void end_bio_bh_io_sync(struct bio *bio, int err)
2638{ 2638{
2639 struct buffer_head *bh = bio->bi_private; 2639 struct buffer_head *bh = bio->bi_private;
2640 2640
2641 if (bio->bi_size)
2642 return 1;
2643
2644 if (err == -EOPNOTSUPP) { 2641 if (err == -EOPNOTSUPP) {
2645 set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); 2642 set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
2646 set_bit(BH_Eopnotsupp, &bh->b_state); 2643 set_bit(BH_Eopnotsupp, &bh->b_state);
@@ -2648,7 +2645,6 @@ static int end_bio_bh_io_sync(struct bio *bio, unsigned int bytes_done, int err)
2648 2645
2649 bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags)); 2646 bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
2650 bio_put(bio); 2647 bio_put(bio);
2651 return 0;
2652} 2648}
2653 2649
2654int submit_bh(int rw, struct buffer_head * bh) 2650int submit_bh(int rw, struct buffer_head * bh)
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 901dc55e9f54..b5928a7b6a5a 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -264,15 +264,12 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio);
264/* 264/*
265 * Asynchronous IO callback. 265 * Asynchronous IO callback.
266 */ 266 */
267static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error) 267static void dio_bio_end_aio(struct bio *bio, int error)
268{ 268{
269 struct dio *dio = bio->bi_private; 269 struct dio *dio = bio->bi_private;
270 unsigned long remaining; 270 unsigned long remaining;
271 unsigned long flags; 271 unsigned long flags;
272 272
273 if (bio->bi_size)
274 return 1;
275
276 /* cleanup the bio */ 273 /* cleanup the bio */
277 dio_bio_complete(dio, bio); 274 dio_bio_complete(dio, bio);
278 275
@@ -287,8 +284,6 @@ static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error)
287 aio_complete(dio->iocb, ret, 0); 284 aio_complete(dio->iocb, ret, 0);
288 kfree(dio); 285 kfree(dio);
289 } 286 }
290
291 return 0;
292} 287}
293 288
294/* 289/*
@@ -298,21 +293,17 @@ static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error)
298 * During I/O bi_private points at the dio. After I/O, bi_private is used to 293 * During I/O bi_private points at the dio. After I/O, bi_private is used to
299 * implement a singly-linked list of completed BIOs, at dio->bio_list. 294 * implement a singly-linked list of completed BIOs, at dio->bio_list.
300 */ 295 */
301static int dio_bio_end_io(struct bio *bio, unsigned int bytes_done, int error) 296static void dio_bio_end_io(struct bio *bio, int error)
302{ 297{
303 struct dio *dio = bio->bi_private; 298 struct dio *dio = bio->bi_private;
304 unsigned long flags; 299 unsigned long flags;
305 300
306 if (bio->bi_size)
307 return 1;
308
309 spin_lock_irqsave(&dio->bio_lock, flags); 301 spin_lock_irqsave(&dio->bio_lock, flags);
310 bio->bi_private = dio->bio_list; 302 bio->bi_private = dio->bio_list;
311 dio->bio_list = bio; 303 dio->bio_list = bio;
312 if (--dio->refcount == 1 && dio->waiter) 304 if (--dio->refcount == 1 && dio->waiter)
313 wake_up_process(dio->waiter); 305 wake_up_process(dio->waiter);
314 spin_unlock_irqrestore(&dio->bio_lock, flags); 306 spin_unlock_irqrestore(&dio->bio_lock, flags);
315 return 0;
316} 307}
317 308
318static int 309static int
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index f916b9740c75..2473e2a86d1b 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -160,11 +160,9 @@ int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent)
160} 160}
161 161
162 162
163static int end_bio_io_page(struct bio *bio, unsigned int bytes_done, int error) 163static void end_bio_io_page(struct bio *bio, int error)
164{ 164{
165 struct page *page = bio->bi_private; 165 struct page *page = bio->bi_private;
166 if (bio->bi_size)
167 return 1;
168 166
169 if (!error) 167 if (!error)
170 SetPageUptodate(page); 168 SetPageUptodate(page);
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index de3e4a506dbc..57c3b8ac36bf 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -2200,16 +2200,13 @@ static int lbmIOWait(struct lbuf * bp, int flag)
2200 * 2200 *
2201 * executed at INTIODONE level 2201 * executed at INTIODONE level
2202 */ 2202 */
2203static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) 2203static void lbmIODone(struct bio *bio, int error)
2204{ 2204{
2205 struct lbuf *bp = bio->bi_private; 2205 struct lbuf *bp = bio->bi_private;
2206 struct lbuf *nextbp, *tail; 2206 struct lbuf *nextbp, *tail;
2207 struct jfs_log *log; 2207 struct jfs_log *log;
2208 unsigned long flags; 2208 unsigned long flags;
2209 2209
2210 if (bio->bi_size)
2211 return 1;
2212
2213 /* 2210 /*
2214 * get back jfs buffer bound to the i/o buffer 2211 * get back jfs buffer bound to the i/o buffer
2215 */ 2212 */
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 62e96be02acf..1332adc0b9fa 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -280,14 +280,10 @@ static void last_read_complete(struct page *page)
280 unlock_page(page); 280 unlock_page(page);
281} 281}
282 282
283static int metapage_read_end_io(struct bio *bio, unsigned int bytes_done, 283static void metapage_read_end_io(struct bio *bio, int err)
284 int err)
285{ 284{
286 struct page *page = bio->bi_private; 285 struct page *page = bio->bi_private;
287 286
288 if (bio->bi_size)
289 return 1;
290
291 if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { 287 if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) {
292 printk(KERN_ERR "metapage_read_end_io: I/O error\n"); 288 printk(KERN_ERR "metapage_read_end_io: I/O error\n");
293 SetPageError(page); 289 SetPageError(page);
@@ -341,16 +337,12 @@ static void last_write_complete(struct page *page)
341 end_page_writeback(page); 337 end_page_writeback(page);
342} 338}
343 339
344static int metapage_write_end_io(struct bio *bio, unsigned int bytes_done, 340static void metapage_write_end_io(struct bio *bio, int err)
345 int err)
346{ 341{
347 struct page *page = bio->bi_private; 342 struct page *page = bio->bi_private;
348 343
349 BUG_ON(!PagePrivate(page)); 344 BUG_ON(!PagePrivate(page));
350 345
351 if (bio->bi_size)
352 return 1;
353
354 if (! test_bit(BIO_UPTODATE, &bio->bi_flags)) { 346 if (! test_bit(BIO_UPTODATE, &bio->bi_flags)) {
355 printk(KERN_ERR "metapage_write_end_io: I/O error\n"); 347 printk(KERN_ERR "metapage_write_end_io: I/O error\n");
356 SetPageError(page); 348 SetPageError(page);
diff --git a/fs/mpage.c b/fs/mpage.c
index c1698f2291aa..b1c3e5890508 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -39,14 +39,11 @@
39 * status of that page is hard. See end_buffer_async_read() for the details. 39 * status of that page is hard. See end_buffer_async_read() for the details.
40 * There is no point in duplicating all that complexity. 40 * There is no point in duplicating all that complexity.
41 */ 41 */
42static int mpage_end_io_read(struct bio *bio, unsigned int bytes_done, int err) 42static void mpage_end_io_read(struct bio *bio, int err)
43{ 43{
44 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 44 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
45 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; 45 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
46 46
47 if (bio->bi_size)
48 return 1;
49
50 do { 47 do {
51 struct page *page = bvec->bv_page; 48 struct page *page = bvec->bv_page;
52 49
@@ -62,17 +59,13 @@ static int mpage_end_io_read(struct bio *bio, unsigned int bytes_done, int err)
62 unlock_page(page); 59 unlock_page(page);
63 } while (bvec >= bio->bi_io_vec); 60 } while (bvec >= bio->bi_io_vec);
64 bio_put(bio); 61 bio_put(bio);
65 return 0;
66} 62}
67 63
68static int mpage_end_io_write(struct bio *bio, unsigned int bytes_done, int err) 64static void mpage_end_io_write(struct bio *bio, int err)
69{ 65{
70 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 66 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
71 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; 67 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
72 68
73 if (bio->bi_size)
74 return 1;
75
76 do { 69 do {
77 struct page *page = bvec->bv_page; 70 struct page *page = bvec->bv_page;
78 71
@@ -87,7 +80,6 @@ static int mpage_end_io_write(struct bio *bio, unsigned int bytes_done, int err)
87 end_page_writeback(page); 80 end_page_writeback(page);
88 } while (bvec >= bio->bi_io_vec); 81 } while (bvec >= bio->bi_io_vec);
89 bio_put(bio); 82 bio_put(bio);
90 return 0;
91} 83}
92 84
93static struct bio *mpage_bio_submit(int rw, struct bio *bio) 85static struct bio *mpage_bio_submit(int rw, struct bio *bio)
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 2bd7f788cf34..da2c2b442b49 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -217,7 +217,6 @@ static void o2hb_wait_on_io(struct o2hb_region *reg,
217} 217}
218 218
219static int o2hb_bio_end_io(struct bio *bio, 219static int o2hb_bio_end_io(struct bio *bio,
220 unsigned int bytes_done,
221 int error) 220 int error)
222{ 221{
223 struct o2hb_bio_wait_ctxt *wc = bio->bi_private; 222 struct o2hb_bio_wait_ctxt *wc = bio->bi_private;
@@ -227,9 +226,6 @@ static int o2hb_bio_end_io(struct bio *bio,
227 wc->wc_error = error; 226 wc->wc_error = error;
228 } 227 }
229 228
230 if (bio->bi_size)
231 return 1;
232
233 o2hb_bio_wait_dec(wc, 1); 229 o2hb_bio_wait_dec(wc, 1);
234 bio_put(bio); 230 bio_put(bio);
235 return 0; 231 return 0;
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 5f152f60d74d..3f13519436af 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -326,14 +326,10 @@ xfs_iomap_valid(
326STATIC int 326STATIC int
327xfs_end_bio( 327xfs_end_bio(
328 struct bio *bio, 328 struct bio *bio,
329 unsigned int bytes_done,
330 int error) 329 int error)
331{ 330{
332 xfs_ioend_t *ioend = bio->bi_private; 331 xfs_ioend_t *ioend = bio->bi_private;
333 332
334 if (bio->bi_size)
335 return 1;
336
337 ASSERT(atomic_read(&bio->bi_cnt) >= 1); 333 ASSERT(atomic_read(&bio->bi_cnt) >= 1);
338 ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error; 334 ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error;
339 335
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index b0f0e58866de..6a75f4d984a1 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1106,16 +1106,12 @@ _xfs_buf_ioend(
1106STATIC int 1106STATIC int
1107xfs_buf_bio_end_io( 1107xfs_buf_bio_end_io(
1108 struct bio *bio, 1108 struct bio *bio,
1109 unsigned int bytes_done,
1110 int error) 1109 int error)
1111{ 1110{
1112 xfs_buf_t *bp = (xfs_buf_t *)bio->bi_private; 1111 xfs_buf_t *bp = (xfs_buf_t *)bio->bi_private;
1113 unsigned int blocksize = bp->b_target->bt_bsize; 1112 unsigned int blocksize = bp->b_target->bt_bsize;
1114 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; 1113 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
1115 1114
1116 if (bio->bi_size)
1117 return 1;
1118
1119 if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) 1115 if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
1120 bp->b_error = EIO; 1116 bp->b_error = EIO;
1121 1117