diff options
-rw-r--r-- | fs/btrfs/disk-io.c | 12 | ||||
-rw-r--r-- | fs/btrfs/disk-io.h | 2 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 4 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 2 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 9 |
5 files changed, 17 insertions, 12 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8123b03b1f9d..548cb540e516 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1078,7 +1078,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr) | |||
1078 | struct extent_buffer *buf = NULL; | 1078 | struct extent_buffer *buf = NULL; |
1079 | struct inode *btree_inode = root->fs_info->btree_inode; | 1079 | struct inode *btree_inode = root->fs_info->btree_inode; |
1080 | 1080 | ||
1081 | buf = btrfs_find_create_tree_block(root, bytenr, root->nodesize); | 1081 | buf = btrfs_find_create_tree_block(root, bytenr); |
1082 | if (!buf) | 1082 | if (!buf) |
1083 | return; | 1083 | return; |
1084 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, | 1084 | read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, |
@@ -1094,7 +1094,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, | |||
1094 | struct extent_io_tree *io_tree = &BTRFS_I(btree_inode)->io_tree; | 1094 | struct extent_io_tree *io_tree = &BTRFS_I(btree_inode)->io_tree; |
1095 | int ret; | 1095 | int ret; |
1096 | 1096 | ||
1097 | buf = btrfs_find_create_tree_block(root, bytenr, root->nodesize); | 1097 | buf = btrfs_find_create_tree_block(root, bytenr); |
1098 | if (!buf) | 1098 | if (!buf) |
1099 | return 0; | 1099 | return 0; |
1100 | 1100 | ||
@@ -1125,12 +1125,12 @@ struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, | |||
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, | 1127 | struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, |
1128 | u64 bytenr, u32 blocksize) | 1128 | u64 bytenr) |
1129 | { | 1129 | { |
1130 | if (btrfs_test_is_dummy_root(root)) | 1130 | if (btrfs_test_is_dummy_root(root)) |
1131 | return alloc_test_extent_buffer(root->fs_info, bytenr, | 1131 | return alloc_test_extent_buffer(root->fs_info, bytenr, |
1132 | blocksize); | 1132 | root->nodesize); |
1133 | return alloc_extent_buffer(root->fs_info, bytenr, blocksize); | 1133 | return alloc_extent_buffer(root->fs_info, bytenr, root->nodesize); |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | 1136 | ||
@@ -1152,7 +1152,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, | |||
1152 | struct extent_buffer *buf = NULL; | 1152 | struct extent_buffer *buf = NULL; |
1153 | int ret; | 1153 | int ret; |
1154 | 1154 | ||
1155 | buf = btrfs_find_create_tree_block(root, bytenr, root->nodesize); | 1155 | buf = btrfs_find_create_tree_block(root, bytenr); |
1156 | if (!buf) | 1156 | if (!buf) |
1157 | return NULL; | 1157 | return NULL; |
1158 | 1158 | ||
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 4d4ecdd9f4a2..27d44c0fd236 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -50,7 +50,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr); | |||
50 | int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, | 50 | int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, |
51 | int mirror_num, struct extent_buffer **eb); | 51 | int mirror_num, struct extent_buffer **eb); |
52 | struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, | 52 | struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, |
53 | u64 bytenr, u32 blocksize); | 53 | u64 bytenr); |
54 | void clean_tree_block(struct btrfs_trans_handle *trans, | 54 | void clean_tree_block(struct btrfs_trans_handle *trans, |
55 | struct btrfs_root *root, struct extent_buffer *buf); | 55 | struct btrfs_root *root, struct extent_buffer *buf); |
56 | int open_ctree(struct super_block *sb, | 56 | int open_ctree(struct super_block *sb, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 50ebc74db508..8ff31f81d870 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7219,7 +7219,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
7219 | { | 7219 | { |
7220 | struct extent_buffer *buf; | 7220 | struct extent_buffer *buf; |
7221 | 7221 | ||
7222 | buf = btrfs_find_create_tree_block(root, bytenr, root->nodesize); | 7222 | buf = btrfs_find_create_tree_block(root, bytenr); |
7223 | if (!buf) | 7223 | if (!buf) |
7224 | return ERR_PTR(-ENOMEM); | 7224 | return ERR_PTR(-ENOMEM); |
7225 | btrfs_set_header_generation(buf, trans->transid); | 7225 | btrfs_set_header_generation(buf, trans->transid); |
@@ -7825,7 +7825,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
7825 | 7825 | ||
7826 | next = btrfs_find_tree_block(root, bytenr); | 7826 | next = btrfs_find_tree_block(root, bytenr); |
7827 | if (!next) { | 7827 | if (!next) { |
7828 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); | 7828 | next = btrfs_find_create_tree_block(root, bytenr); |
7829 | if (!next) | 7829 | if (!next) |
7830 | return -ENOMEM; | 7830 | return -ENOMEM; |
7831 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, next, | 7831 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, next, |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 9a02da16f2be..4a42edc224a8 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2164,7 +2164,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, | |||
2164 | parent = path->nodes[*level]; | 2164 | parent = path->nodes[*level]; |
2165 | root_owner = btrfs_header_owner(parent); | 2165 | root_owner = btrfs_header_owner(parent); |
2166 | 2166 | ||
2167 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); | 2167 | next = btrfs_find_create_tree_block(root, bytenr); |
2168 | if (!next) | 2168 | if (!next) |
2169 | return -ENOMEM; | 2169 | return -ENOMEM; |
2170 | 2170 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0144790e296e..f0af9cd0814c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -6247,8 +6247,13 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
6247 | u32 cur; | 6247 | u32 cur; |
6248 | struct btrfs_key key; | 6248 | struct btrfs_key key; |
6249 | 6249 | ||
6250 | sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET, | 6250 | ASSERT(BTRFS_SUPER_INFO_SIZE <= root->nodesize); |
6251 | BTRFS_SUPER_INFO_SIZE); | 6251 | /* |
6252 | * This will create extent buffer of nodesize, superblock size is | ||
6253 | * fixed to BTRFS_SUPER_INFO_SIZE. If nodesize > sb size, this will | ||
6254 | * overallocate but we can keep it as-is, only the first page is used. | ||
6255 | */ | ||
6256 | sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET); | ||
6252 | if (!sb) | 6257 | if (!sb) |
6253 | return -ENOMEM; | 6258 | return -ENOMEM; |
6254 | btrfs_set_buffer_uptodate(sb); | 6259 | btrfs_set_buffer_uptodate(sb); |