@@ -1895,7 +1895,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
}
next = btrfs_find_tree_block(gfs_info, bytenr, gfs_info->nodesize);
- if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
+ if (!next || !btrfs_buffer_uptodate(next, ptr_gen, 0)) {
free_extent_buffer(next);
reada_walk_down(root, cur, path->slots[*level]);
next = read_tree_block(gfs_info, bytenr,
@@ -5043,7 +5043,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
}
next = btrfs_find_tree_block(gfs_info, bytenr, gfs_info->nodesize);
- if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
+ if (!next || !btrfs_buffer_uptodate(next, ptr_gen, 0)) {
free_extent_buffer(next);
reada_walk_down(root, cur, path->slots[*level]);
next = read_tree_block(gfs_info, bytenr,
@@ -246,7 +246,7 @@ void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
struct btrfs_device *device;
eb = btrfs_find_tree_block(fs_info, bytenr, fs_info->nodesize);
- if (!(eb && btrfs_buffer_uptodate(eb, parent_transid)) &&
+ if (!(eb && btrfs_buffer_uptodate(eb, parent_transid, 0)) &&
!btrfs_map_block(fs_info, READ, bytenr, &length, &multi, 0,
NULL)) {
device = multi->stripes[0].dev;
@@ -367,7 +367,7 @@ struct extent_buffer *read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
if (!eb)
return ERR_PTR(-ENOMEM);
- if (btrfs_buffer_uptodate(eb, parent_transid))
+ if (btrfs_buffer_uptodate(eb, parent_transid, 0))
return eb;
num_copies = btrfs_num_copies(fs_info, eb->start, eb->len);
@@ -478,7 +478,7 @@ int write_tree_block(struct btrfs_trans_handle *trans,
BUG();
}
- if (trans && !btrfs_buffer_uptodate(eb, trans->transid))
+ if (trans && !btrfs_buffer_uptodate(eb, trans->transid, 0))
BUG();
btrfs_clear_header_flag(eb, BTRFS_HEADER_FLAG_CSUM_NEW);
@@ -2262,7 +2262,8 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *eb)
set_extent_buffer_dirty(eb);
}
-int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
+int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
+ int atomic)
{
int ret;
@@ -201,7 +201,8 @@ struct btrfs_root *btrfs_read_fs_root_no_cache(struct btrfs_fs_info *fs_info,
struct btrfs_key *location);
int btrfs_free_fs_root(struct btrfs_root *root);
void btrfs_mark_buffer_dirty(struct extent_buffer *buf);
-int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid);
+int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
+ int atomic);
int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
int btrfs_csum_data(struct btrfs_fs_info *fs_info, u16 csum_type, const u8 *data,
u8 *out, size_t len);
@@ -1893,7 +1893,7 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans, u64 bytenr,
* reuse anything from the tree log root because
* it has tiny sub-transactions.
*/
- if (btrfs_buffer_uptodate(buf, 0)) {
+ if (btrfs_buffer_uptodate(buf, 0, 0)) {
u64 header_owner = btrfs_header_owner(buf);
u64 header_transid = btrfs_header_generation(buf);
if (header_owner != BTRFS_TREE_LOG_OBJECTID &&
We have this extra argument in the kernel to indicate if we are atomic and thus can't lock the io_tree when checking the transid for an extent buffer. This isn't necessary in btrfs-progs, but to allow for easier sync'ing of ctree.c add this argument to our copy of btrfs_buffer_uptodate. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- check/main.c | 2 +- check/mode-lowmem.c | 2 +- kernel-shared/disk-io.c | 9 +++++---- kernel-shared/disk-io.h | 3 ++- kernel-shared/extent-tree.c | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-)