Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374869
b: refs/heads/master
c: 47fb091
h: refs/heads/master
i:
  374867: 8892587
v: v3
  • Loading branch information
Jan Schmidt authored and Josef Bacik committed May 6, 2013
1 parent 02f2f4e commit 066198f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30b0463a9394d9e41596e96def5461fe33222f13
refs/heads/master: 47fb091fb787420cd195e66f162737401cce023f
18 changes: 11 additions & 7 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,13 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
btrfs_set_header_nritems(eb, n);
}

/*
* Called with eb read locked. If the buffer cannot be rewinded, the same buffer
* is returned. If rewind operations happen, a fresh buffer is returned. The
* returned buffer is always read-locked. If the returned buffer is not the
* input buffer, the lock on the input buffer is released and the input buffer
* is freed (its refcount is decremented).
*/
static struct extent_buffer *
tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
u64 time_seq)
Expand Down Expand Up @@ -1224,8 +1231,11 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
}

extent_buffer_get(eb_rewin);
btrfs_tree_read_unlock(eb);
free_extent_buffer(eb);

extent_buffer_get(eb_rewin);
btrfs_tree_read_lock(eb_rewin);
__tree_mod_log_rewind(eb_rewin, time_seq, tm);
WARN_ON(btrfs_header_nritems(eb_rewin) >
BTRFS_NODEPTRS_PER_BLOCK(fs_info->tree_root));
Expand Down Expand Up @@ -2794,15 +2804,9 @@ int btrfs_search_old_slot(struct btrfs_root *root, struct btrfs_key *key,
btrfs_clear_path_blocking(p, b,
BTRFS_READ_LOCK);
}
b = tree_mod_log_rewind(root->fs_info, b, time_seq);
p->locks[level] = BTRFS_READ_LOCK;
p->nodes[level] = b;
b = tree_mod_log_rewind(root->fs_info, b, time_seq);
if (b != p->nodes[level]) {
btrfs_tree_unlock_rw(p->nodes[level],
p->locks[level]);
p->locks[level] = 0;
p->nodes[level] = b;
}
} else {
p->slots[level] = slot;
unlock_up(p, level, lowest_unlock, 0, NULL);
Expand Down

0 comments on commit 066198f

Please sign in to comment.