+static void reada_extent_leaves(struct btrfs_root *root,
+ struct btrfs_path *path, u64 limit)
+{
+ struct btrfs_node *node;
+ int i;
+ int nritems;
+ u64 item_objectid;
+ u64 blocknr;
+ int slot;
+ int ret;
+
+ if (!path->nodes[1])
+ return;
+ node = btrfs_buffer_node(path->nodes[1]);
+ slot = path->slots[1] + 1;
+ nritems = btrfs_header_nritems(&node->header);
+ for (i = slot; i < nritems && i < slot + 8; i++) {
+ item_objectid = btrfs_disk_key_objectid(&node->ptrs[i].key);
+ if (item_objectid > limit)
+ break;
+ blocknr = btrfs_node_blockptr(node, i);
+ ret = readahead_tree_block(root, blocknr);
+ if (ret)
+ break;
+ }
+}
+