WARN_ON(1);
}
eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS);
- read_extent_buffer_pages(tree, eb, start + PAGE_CACHE_SIZE, 1);
+ read_extent_buffer_pages(tree, eb, start + PAGE_CACHE_SIZE, 1,
+ btree_get_extent);
btrfs_clear_buffer_defrag(eb);
found_start = btrfs_header_bytenr(eb);
if (found_start != start) {
if (!buf)
return 0;
read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
- buf, 0, 0);
+ buf, 0, 0, btree_get_extent);
free_extent_buffer(buf);
return ret;
}
buf = btrfs_find_create_tree_block(root, bytenr, blocksize);
if (!buf)
return NULL;
- read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, buf, 0, 1);
+ read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, buf, 0, 1,
+ btree_get_extent);
if (buf->flags & EXTENT_CSUM)
return buf;
struct btrfs_root *root = BTRFS_I(buf->first_page->mapping->host)->root;
struct inode *btree_inode = root->fs_info->btree_inode;
return read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
- buf, 0, 1);
+ buf, 0, 1, btree_get_extent);
}
static struct extent_io_ops btree_extent_io_ops = {
int read_extent_buffer_pages(struct extent_io_tree *tree,
struct extent_buffer *eb,
- u64 start,
- int wait)
+ u64 start, int wait,
+ get_extent_t *get_extent)
{
unsigned long i;
unsigned long start_i;
int err;
int ret = 0;
unsigned long num_pages;
+ struct bio *bio = NULL;
+
if (eb->flags & EXTENT_UPTODATE)
return 0;
lock_page(page);
}
if (!PageUptodate(page)) {
- err = page->mapping->a_ops->readpage(NULL, page);
+ err = __extent_read_full_page(tree, page,
+ get_extent, &bio);
if (err) {
ret = err;
}
}
}
+ if (bio)
+ submit_one_bio(READ, bio);
+
if (ret || !wait) {
return ret;
}
gfp_t mask);
void free_extent_buffer(struct extent_buffer *eb);
int read_extent_buffer_pages(struct extent_io_tree *tree,
- struct extent_buffer *eb, u64 start, int wait);
+ struct extent_buffer *eb, u64 start, int wait,
+ get_extent_t *get_extent);
static inline void extent_buffer_get(struct extent_buffer *eb)
{