diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 3 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 14 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 6 |
4 files changed, 20 insertions, 5 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index f7a0a64b868f..f61c16c1481a 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -48,8 +48,6 @@ struct btrfs_path *btrfs_alloc_path(void) | |||
48 | { | 48 | { |
49 | struct btrfs_path *path; | 49 | struct btrfs_path *path; |
50 | path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); | 50 | path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); |
51 | if (path) | ||
52 | path->reada = 1; | ||
53 | return path; | 51 | return path; |
54 | } | 52 | } |
55 | 53 | ||
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 96be62450318..1ba2cc58eab5 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -347,7 +347,7 @@ static int caching_kthread(void *data) | |||
347 | */ | 347 | */ |
348 | path->skip_locking = 1; | 348 | path->skip_locking = 1; |
349 | path->search_commit_root = 1; | 349 | path->search_commit_root = 1; |
350 | path->reada = 2; | 350 | path->reada = 1; |
351 | 351 | ||
352 | key.objectid = last; | 352 | key.objectid = last; |
353 | key.offset = 0; | 353 | key.offset = 0; |
@@ -8556,6 +8556,7 @@ int btrfs_read_block_groups(struct btrfs_root *root) | |||
8556 | path = btrfs_alloc_path(); | 8556 | path = btrfs_alloc_path(); |
8557 | if (!path) | 8557 | if (!path) |
8558 | return -ENOMEM; | 8558 | return -ENOMEM; |
8559 | path->reada = 1; | ||
8559 | 8560 | ||
8560 | cache_gen = btrfs_super_cache_generation(&root->fs_info->super_copy); | 8561 | cache_gen = btrfs_super_cache_generation(&root->fs_info->super_copy); |
8561 | if (cache_gen != 0 && | 8562 | if (cache_gen != 0 && |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index dd5938a7de21..6228a304b547 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4242,7 +4242,9 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4242 | filp->f_pos = 2; | 4242 | filp->f_pos = 2; |
4243 | } | 4243 | } |
4244 | path = btrfs_alloc_path(); | 4244 | path = btrfs_alloc_path(); |
4245 | path->reada = 2; | 4245 | if (!path) |
4246 | return -ENOMEM; | ||
4247 | path->reada = 1; | ||
4246 | 4248 | ||
4247 | btrfs_set_key_type(&key, key_type); | 4249 | btrfs_set_key_type(&key, key_type); |
4248 | key.offset = filp->f_pos; | 4250 | key.offset = filp->f_pos; |
@@ -5043,7 +5045,15 @@ again: | |||
5043 | 5045 | ||
5044 | if (!path) { | 5046 | if (!path) { |
5045 | path = btrfs_alloc_path(); | 5047 | path = btrfs_alloc_path(); |
5046 | BUG_ON(!path); | 5048 | if (!path) { |
5049 | err = -ENOMEM; | ||
5050 | goto out; | ||
5051 | } | ||
5052 | /* | ||
5053 | * Chances are we'll be called again, so go ahead and do | ||
5054 | * readahead | ||
5055 | */ | ||
5056 | path->reada = 1; | ||
5047 | } | 5057 | } |
5048 | 5058 | ||
5049 | ret = btrfs_lookup_file_extent(trans, root, path, | 5059 | ret = btrfs_lookup_file_extent(trans, root, path, |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 09c30d37d43e..5872b41581f4 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -676,6 +676,8 @@ struct backref_node *build_backref_tree(struct reloc_control *rc, | |||
676 | err = -ENOMEM; | 676 | err = -ENOMEM; |
677 | goto out; | 677 | goto out; |
678 | } | 678 | } |
679 | path1->reada = 1; | ||
680 | path2->reada = 2; | ||
679 | 681 | ||
680 | node = alloc_backref_node(cache); | 682 | node = alloc_backref_node(cache); |
681 | if (!node) { | 683 | if (!node) { |
@@ -1996,6 +1998,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc, | |||
1996 | path = btrfs_alloc_path(); | 1998 | path = btrfs_alloc_path(); |
1997 | if (!path) | 1999 | if (!path) |
1998 | return -ENOMEM; | 2000 | return -ENOMEM; |
2001 | path->reada = 1; | ||
1999 | 2002 | ||
2000 | reloc_root = root->reloc_root; | 2003 | reloc_root = root->reloc_root; |
2001 | root_item = &reloc_root->root_item; | 2004 | root_item = &reloc_root->root_item; |
@@ -3297,6 +3300,7 @@ static int find_data_references(struct reloc_control *rc, | |||
3297 | path = btrfs_alloc_path(); | 3300 | path = btrfs_alloc_path(); |
3298 | if (!path) | 3301 | if (!path) |
3299 | return -ENOMEM; | 3302 | return -ENOMEM; |
3303 | path->reada = 1; | ||
3300 | 3304 | ||
3301 | root = read_fs_root(rc->extent_root->fs_info, ref_root); | 3305 | root = read_fs_root(rc->extent_root->fs_info, ref_root); |
3302 | if (IS_ERR(root)) { | 3306 | if (IS_ERR(root)) { |
@@ -3665,6 +3669,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3665 | path = btrfs_alloc_path(); | 3669 | path = btrfs_alloc_path(); |
3666 | if (!path) | 3670 | if (!path) |
3667 | return -ENOMEM; | 3671 | return -ENOMEM; |
3672 | path->reada = 1; | ||
3668 | 3673 | ||
3669 | ret = prepare_to_relocate(rc); | 3674 | ret = prepare_to_relocate(rc); |
3670 | if (ret) { | 3675 | if (ret) { |
@@ -4090,6 +4095,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) | |||
4090 | path = btrfs_alloc_path(); | 4095 | path = btrfs_alloc_path(); |
4091 | if (!path) | 4096 | if (!path) |
4092 | return -ENOMEM; | 4097 | return -ENOMEM; |
4098 | path->reada = -1; | ||
4093 | 4099 | ||
4094 | key.objectid = BTRFS_TREE_RELOC_OBJECTID; | 4100 | key.objectid = BTRFS_TREE_RELOC_OBJECTID; |
4095 | key.type = BTRFS_ROOT_ITEM_KEY; | 4101 | key.type = BTRFS_ROOT_ITEM_KEY; |