===================================================================
@@ -776,6 +776,15 @@ static int btree_readpage(struct file *f
return extent_read_full_page(tree, page, btree_get_extent);
}
+static int btree_readpages(struct file *file, struct address_space *mapping,
+ struct list_head *pages, unsigned nr_pages)
+{
+ struct extent_io_tree *tree;
+ tree = &BTRFS_I(mapping->host)->io_tree;
+ return extent_readpages(tree, mapping, pages, nr_pages,
+ btree_get_extent);
+}
+
static int btree_releasepage(struct page *page, gfp_t gfp_flags)
{
struct extent_io_tree *tree;
@@ -819,6 +828,7 @@ static void btree_invalidatepage(struct
static const struct address_space_operations btree_aops = {
.readpage = btree_readpage,
+ .readpages = btree_readpages,
.writepage = btree_writepage,
.writepages = btree_writepages,
.releasepage = btree_releasepage,
===================================================================
@@ -892,6 +892,18 @@ out:
return -ENOENT;
}
+static int btrfs_metadata_readahead(struct super_block *sb, loff_t offset,
+ ssize_t size)
+{
+ struct btrfs_root *tree_root = btrfs_sb(sb);
+ struct inode *btree_inode = tree_root->fs_info->btree_inode;
+ struct address_space *mapping = btree_inode->i_mapping;
+
+ force_page_cache_readahead(mapping, NULL, offset >> PAGE_CACHE_SHIFT,
+ size >> PAGE_CACHE_SHIFT);
+ return 0;
+}
+
static const struct super_operations btrfs_super_ops = {
.drop_inode = btrfs_drop_inode,
.evict_inode = btrfs_evict_inode,
@@ -907,6 +919,7 @@ static const struct super_operations btr
.freeze_fs = btrfs_freeze,
.unfreeze_fs = btrfs_unfreeze,
.metadata_incore = btrfs_metadata_incore,
+ .metadata_readahead = btrfs_metadata_readahead,
};
static const struct file_operations btrfs_ctl_fops = {
===================================================================
@@ -228,6 +228,7 @@ int force_page_cache_readahead(struct ad
}
return ret;
}
+EXPORT_SYMBOL_GPL(force_page_cache_readahead);
/*
* Given a desired number of PAGE_CACHE_SIZE readahead pages, return a