diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-05-28 07:00:39 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-05-28 07:00:39 -0400 |
commit | ff5714cca971848963b87d6b477c16ca8abbaa54 (patch) | |
tree | 17ee34b9b5e00804df4059503f82f6f1d94383a9 /fs/btrfs/ctree.c | |
parent | 174ba50915b08dcfd07c8b5fb795b46a165fa09a (diff) | |
parent | d90c732122a1f6d0efe388a8a204f67f144b2eb3 (diff) |
Merge branch 'for-chris' of
git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-work into for-linus
Conflicts:
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/free-space-cache.c
fs/btrfs/inode.c
fs/btrfs/transaction.c
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index b0e18d986e0a..d84089349c82 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -43,8 +43,6 @@ struct btrfs_path *btrfs_alloc_path(void) | |||
43 | { | 43 | { |
44 | struct btrfs_path *path; | 44 | struct btrfs_path *path; |
45 | path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); | 45 | path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); |
46 | if (path) | ||
47 | path->reada = 1; | ||
48 | return path; | 46 | return path; |
49 | } | 47 | } |
50 | 48 | ||
@@ -1224,6 +1222,7 @@ static void reada_for_search(struct btrfs_root *root, | |||
1224 | u64 search; | 1222 | u64 search; |
1225 | u64 target; | 1223 | u64 target; |
1226 | u64 nread = 0; | 1224 | u64 nread = 0; |
1225 | u64 gen; | ||
1227 | int direction = path->reada; | 1226 | int direction = path->reada; |
1228 | struct extent_buffer *eb; | 1227 | struct extent_buffer *eb; |
1229 | u32 nr; | 1228 | u32 nr; |
@@ -1251,6 +1250,15 @@ static void reada_for_search(struct btrfs_root *root, | |||
1251 | nritems = btrfs_header_nritems(node); | 1250 | nritems = btrfs_header_nritems(node); |
1252 | nr = slot; | 1251 | nr = slot; |
1253 | while (1) { | 1252 | while (1) { |
1253 | if (!node->map_token) { | ||
1254 | unsigned long offset = btrfs_node_key_ptr_offset(nr); | ||
1255 | map_private_extent_buffer(node, offset, | ||
1256 | sizeof(struct btrfs_key_ptr), | ||
1257 | &node->map_token, | ||
1258 | &node->kaddr, | ||
1259 | &node->map_start, | ||
1260 | &node->map_len, KM_USER1); | ||
1261 | } | ||
1254 | if (direction < 0) { | 1262 | if (direction < 0) { |
1255 | if (nr == 0) | 1263 | if (nr == 0) |
1256 | break; | 1264 | break; |
@@ -1268,14 +1276,23 @@ static void reada_for_search(struct btrfs_root *root, | |||
1268 | search = btrfs_node_blockptr(node, nr); | 1276 | search = btrfs_node_blockptr(node, nr); |
1269 | if ((search <= target && target - search <= 65536) || | 1277 | if ((search <= target && target - search <= 65536) || |
1270 | (search > target && search - target <= 65536)) { | 1278 | (search > target && search - target <= 65536)) { |
1271 | readahead_tree_block(root, search, blocksize, | 1279 | gen = btrfs_node_ptr_generation(node, nr); |
1272 | btrfs_node_ptr_generation(node, nr)); | 1280 | if (node->map_token) { |
1281 | unmap_extent_buffer(node, node->map_token, | ||
1282 | KM_USER1); | ||
1283 | node->map_token = NULL; | ||
1284 | } | ||
1285 | readahead_tree_block(root, search, blocksize, gen); | ||
1273 | nread += blocksize; | 1286 | nread += blocksize; |
1274 | } | 1287 | } |
1275 | nscan++; | 1288 | nscan++; |
1276 | if ((nread > 65536 || nscan > 32)) | 1289 | if ((nread > 65536 || nscan > 32)) |
1277 | break; | 1290 | break; |
1278 | } | 1291 | } |
1292 | if (node->map_token) { | ||
1293 | unmap_extent_buffer(node, node->map_token, KM_USER1); | ||
1294 | node->map_token = NULL; | ||
1295 | } | ||
1279 | } | 1296 | } |
1280 | 1297 | ||
1281 | /* | 1298 | /* |
@@ -1648,9 +1665,6 @@ again: | |||
1648 | } | 1665 | } |
1649 | cow_done: | 1666 | cow_done: |
1650 | BUG_ON(!cow && ins_len); | 1667 | BUG_ON(!cow && ins_len); |
1651 | if (level != btrfs_header_level(b)) | ||
1652 | WARN_ON(1); | ||
1653 | level = btrfs_header_level(b); | ||
1654 | 1668 | ||
1655 | p->nodes[level] = b; | 1669 | p->nodes[level] = b; |
1656 | if (!p->skip_locking) | 1670 | if (!p->skip_locking) |