aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f770e8b5cb86..23c49ab2de4c 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -303,7 +303,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
303 offset += cur_len; 303 offset += cur_len;
304 } 304 }
305 if (csum_size > sizeof(inline_result)) { 305 if (csum_size > sizeof(inline_result)) {
306 result = kzalloc(csum_size * sizeof(char), GFP_NOFS); 306 result = kzalloc(csum_size, GFP_NOFS);
307 if (!result) 307 if (!result)
308 return 1; 308 return 1;
309 } else { 309 } else {
@@ -1724,12 +1724,11 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
1724{ 1724{
1725 int err; 1725 int err;
1726 1726
1727 bdi->capabilities = BDI_CAP_MAP_COPY; 1727 err = bdi_setup_and_register(bdi, "btrfs");
1728 err = bdi_setup_and_register(bdi, "btrfs", BDI_CAP_MAP_COPY);
1729 if (err) 1728 if (err)
1730 return err; 1729 return err;
1731 1730
1732 bdi->ra_pages = default_backing_dev_info.ra_pages; 1731 bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_CACHE_SIZE;
1733 bdi->congested_fn = btrfs_congested_fn; 1732 bdi->congested_fn = btrfs_congested_fn;
1734 bdi->congested_data = info; 1733 bdi->congested_data = info;
1735 return 0; 1734 return 0;
@@ -2181,7 +2180,6 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info,
2181 */ 2180 */
2182 fs_info->btree_inode->i_size = OFFSET_MAX; 2181 fs_info->btree_inode->i_size = OFFSET_MAX;
2183 fs_info->btree_inode->i_mapping->a_ops = &btree_aops; 2182 fs_info->btree_inode->i_mapping->a_ops = &btree_aops;
2184 fs_info->btree_inode->i_mapping->backing_dev_info = &fs_info->bdi;
2185 2183
2186 RB_CLEAR_NODE(&BTRFS_I(fs_info->btree_inode)->rb_node); 2184 RB_CLEAR_NODE(&BTRFS_I(fs_info->btree_inode)->rb_node);
2187 extent_io_tree_init(&BTRFS_I(fs_info->btree_inode)->io_tree, 2185 extent_io_tree_init(&BTRFS_I(fs_info->btree_inode)->io_tree,
@@ -2530,7 +2528,7 @@ int open_ctree(struct super_block *sb,
2530 fs_info->free_chunk_space = 0; 2528 fs_info->free_chunk_space = 0;
2531 fs_info->tree_mod_log = RB_ROOT; 2529 fs_info->tree_mod_log = RB_ROOT;
2532 fs_info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL; 2530 fs_info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
2533 fs_info->avg_delayed_ref_runtime = div64_u64(NSEC_PER_SEC, 64); 2531 fs_info->avg_delayed_ref_runtime = NSEC_PER_SEC >> 6; /* div by 64 */
2534 /* readahead state */ 2532 /* readahead state */
2535 INIT_RADIX_TREE(&fs_info->reada_tree, GFP_NOFS & ~__GFP_WAIT); 2533 INIT_RADIX_TREE(&fs_info->reada_tree, GFP_NOFS & ~__GFP_WAIT);
2536 spin_lock_init(&fs_info->reada_lock); 2534 spin_lock_init(&fs_info->reada_lock);