This function not really completely written yet, I supposed. But I
don't really know how to fix it either.
In extent_io.c:
static int submit_extent_page(int rw, struct extent_io_tree *tree,
struct page *page, sector_t sector,
size_t size, unsigned long offset,
struct block_device *bdev,
struct bio **bio_ret,
unsigned long max_pages,
bio_end_io_t end_io_func)
{
int ret = 0;
struct bio *bio;
int nr;
if (bio_ret && *bio_ret) {
bio = *bio_ret;
if (bio->bi_sector + (bio->bi_size >> 9) != sector
||
bio_add_page(bio, page, size, offset) < size) {
ret = submit_one_bio(rw, bio);
bio = NULL;
} else {
return 0;===>>>error condition.
}
}
nr = bio_get_nr_vecs(bdev);
bio = extent_bio_alloc(bdev, sector, nr, GFP_NOFS | __GFP_HIGH);
if (!bio) {
printk("failed to allocate bio nr %d\n", nr); ====>
what to do after this????? should we just return 0 just like above????
}
bio_add_page(bio, page, size, offset);==>bio_add_page() will
immediate DEREFERENCE the bio ptr, and so it will lead to crashes.
bio->bi_end_io = end_io_func;
bio->bi_private = tree;
????
--
Regards,
Peter Teoh