diff options
author | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-10-23 05:28:27 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-10-24 06:36:38 -0400 |
commit | 5b6602e762cae17c8891d19698afea451e9c1d95 (patch) | |
tree | d7a4ccfc3d56e3c94d1fab3efcd14464e3df357e /fs/btrfs/ctree.c | |
parent | 834328a8493079d15f30866ace42489463f52571 (diff) |
Btrfs: determine level of old roots
In btrfs_find_all_roots' termination condition, we compare the level of the
old buffer we got from btrfs_search_old_slot to the level of the current
root node. We'd better compare it to the level of the rewinded root node.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index d9308c38a8f2..ef68c33eefd9 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -1297,6 +1297,23 @@ get_old_root(struct btrfs_root *root, u64 time_seq) | |||
1297 | return eb; | 1297 | return eb; |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq) | ||
1301 | { | ||
1302 | struct tree_mod_elem *tm; | ||
1303 | int level; | ||
1304 | |||
1305 | tm = __tree_mod_log_oldest_root(root->fs_info, root, time_seq); | ||
1306 | if (tm && tm->op == MOD_LOG_ROOT_REPLACE) { | ||
1307 | level = tm->old_root.level; | ||
1308 | } else { | ||
1309 | rcu_read_lock(); | ||
1310 | level = btrfs_header_level(root->node); | ||
1311 | rcu_read_unlock(); | ||
1312 | } | ||
1313 | |||
1314 | return level; | ||
1315 | } | ||
1316 | |||
1300 | static inline int should_cow_block(struct btrfs_trans_handle *trans, | 1317 | static inline int should_cow_block(struct btrfs_trans_handle *trans, |
1301 | struct btrfs_root *root, | 1318 | struct btrfs_root *root, |
1302 | struct extent_buffer *buf) | 1319 | struct extent_buffer *buf) |