Skip to content

Commit 0a2118d

Browse files
Jens Axboechrismason-xx
authored andcommitted
Btrfs: Fix bi_end_io() functions on > 2.6.23 kernels
It now returns void and it is never called for partial completions, so the bio->bi_size check must go. Signed-off-by: Chris Mason <chris.mason@oracle.com>
1 parent ae2f541 commit 0a2118d

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎fs/btrfs/extent_map.c‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/spinlock.h>
1010
#include <linux/blkdev.h>
1111
#include <linux/swap.h>
12+
#include <linux/version.h>
1213
#include "extent_map.h"
1314

1415
/* temporary define until extent_map moves out of btrfs */
@@ -1274,8 +1275,12 @@ static int check_page_writeback(struct extent_map_tree *tree,
12741275
* Scheduling is not allowed, so the extent state tree is expected
12751276
* to have one and only one object corresponding to this IO.
12761277
*/
1278+
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
1279+
static void end_bio_extent_writepage(struct bio *bio, int err)
1280+
#else
12771281
static int end_bio_extent_writepage(struct bio *bio,
12781282
unsigned int bytes_done, int err)
1283+
#endif
12791284
{
12801285
const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
12811286
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
@@ -1284,8 +1289,10 @@ static int end_bio_extent_writepage(struct bio *bio,
12841289
u64 end;
12851290
int whole_page;
12861291

1292+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
12871293
if (bio->bi_size)
12881294
return 1;
1295+
#endif
12891296

12901297
do {
12911298
struct page *page = bvec->bv_page;
@@ -1316,7 +1323,9 @@ static int end_bio_extent_writepage(struct bio *bio,
13161323
} while (bvec >= bio->bi_io_vec);
13171324

13181325
bio_put(bio);
1326+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
13191327
return 0;
1328+
#endif
13201329
}
13211330

13221331
/*
@@ -1330,8 +1339,12 @@ static int end_bio_extent_writepage(struct bio *bio,
13301339
* Scheduling is not allowed, so the extent state tree is expected
13311340
* to have one and only one object corresponding to this IO.
13321341
*/
1342+
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
1343+
static void end_bio_extent_readpage(struct bio *bio, int err)
1344+
#else
13331345
static int end_bio_extent_readpage(struct bio *bio,
13341346
unsigned int bytes_done, int err)
1347+
#endif
13351348
{
13361349
int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
13371350
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
@@ -1341,8 +1354,10 @@ static int end_bio_extent_readpage(struct bio *bio,
13411354
int whole_page;
13421355
int ret;
13431356

1357+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
13441358
if (bio->bi_size)
13451359
return 1;
1360+
#endif
13461361

13471362
do {
13481363
struct page *page = bvec->bv_page;
@@ -1382,25 +1397,33 @@ static int end_bio_extent_readpage(struct bio *bio,
13821397
} while (bvec >= bio->bi_io_vec);
13831398

13841399
bio_put(bio);
1400+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
13851401
return 0;
1402+
#endif
13861403
}
13871404

13881405
/*
13891406
* IO done from prepare_write is pretty simple, we just unlock
13901407
* the structs in the extent tree when done, and set the uptodate bits
13911408
* as appropriate.
13921409
*/
1410+
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
1411+
static void end_bio_extent_preparewrite(struct bio *bio, int err)
1412+
#else
13931413
static int end_bio_extent_preparewrite(struct bio *bio,
13941414
unsigned int bytes_done, int err)
1415+
#endif
13951416
{
13961417
const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
13971418
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
13981419
struct extent_map_tree *tree = bio->bi_private;
13991420
u64 start;
14001421
u64 end;
14011422

1423+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
14021424
if (bio->bi_size)
14031425
return 1;
1426+
#endif
14041427

14051428
do {
14061429
struct page *page = bvec->bv_page;
@@ -1422,7 +1445,9 @@ static int end_bio_extent_preparewrite(struct bio *bio,
14221445
} while (bvec >= bio->bi_io_vec);
14231446

14241447
bio_put(bio);
1448+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
14251449
return 0;
1450+
#endif
14261451
}
14271452

14281453
static int submit_extent_page(int rw, struct extent_map_tree *tree,

0 commit comments

Comments
 (0)