diff options
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 769e0ff1b4ce..77592931ab4f 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -311,7 +311,7 @@ struct tree_mod_root { | |||
311 | 311 | ||
312 | struct tree_mod_elem { | 312 | struct tree_mod_elem { |
313 | struct rb_node node; | 313 | struct rb_node node; |
314 | u64 index; /* shifted logical */ | 314 | u64 logical; |
315 | u64 seq; | 315 | u64 seq; |
316 | enum mod_log_op op; | 316 | enum mod_log_op op; |
317 | 317 | ||
@@ -435,11 +435,11 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info, | |||
435 | 435 | ||
436 | /* | 436 | /* |
437 | * key order of the log: | 437 | * key order of the log: |
438 | * index -> sequence | 438 | * node/leaf start address -> sequence |
439 | * | 439 | * |
440 | * the index is the shifted logical of the *new* root node for root replace | 440 | * The 'start address' is the logical address of the *new* root node |
441 | * operations, or the shifted logical of the affected block for all other | 441 | * for root replace operations, or the logical address of the affected |
442 | * operations. | 442 | * block for all other operations. |
443 | * | 443 | * |
444 | * Note: must be called with write lock (tree_mod_log_write_lock). | 444 | * Note: must be called with write lock (tree_mod_log_write_lock). |
445 | */ | 445 | */ |
@@ -460,9 +460,9 @@ __tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm) | |||
460 | while (*new) { | 460 | while (*new) { |
461 | cur = container_of(*new, struct tree_mod_elem, node); | 461 | cur = container_of(*new, struct tree_mod_elem, node); |
462 | parent = *new; | 462 | parent = *new; |
463 | if (cur->index < tm->index) | 463 | if (cur->logical < tm->logical) |
464 | new = &((*new)->rb_left); | 464 | new = &((*new)->rb_left); |
465 | else if (cur->index > tm->index) | 465 | else if (cur->logical > tm->logical) |
466 | new = &((*new)->rb_right); | 466 | new = &((*new)->rb_right); |
467 | else if (cur->seq < tm->seq) | 467 | else if (cur->seq < tm->seq) |
468 | new = &((*new)->rb_left); | 468 | new = &((*new)->rb_left); |
@@ -523,7 +523,7 @@ alloc_tree_mod_elem(struct extent_buffer *eb, int slot, | |||
523 | if (!tm) | 523 | if (!tm) |
524 | return NULL; | 524 | return NULL; |
525 | 525 | ||
526 | tm->index = eb->start >> PAGE_CACHE_SHIFT; | 526 | tm->logical = eb->start; |
527 | if (op != MOD_LOG_KEY_ADD) { | 527 | if (op != MOD_LOG_KEY_ADD) { |
528 | btrfs_node_key(eb, &tm->key, slot); | 528 | btrfs_node_key(eb, &tm->key, slot); |
529 | tm->blockptr = btrfs_node_blockptr(eb, slot); | 529 | tm->blockptr = btrfs_node_blockptr(eb, slot); |
@@ -588,7 +588,7 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info, | |||
588 | goto free_tms; | 588 | goto free_tms; |
589 | } | 589 | } |
590 | 590 | ||
591 | tm->index = eb->start >> PAGE_CACHE_SHIFT; | 591 | tm->logical = eb->start; |
592 | tm->slot = src_slot; | 592 | tm->slot = src_slot; |
593 | tm->move.dst_slot = dst_slot; | 593 | tm->move.dst_slot = dst_slot; |
594 | tm->move.nr_items = nr_items; | 594 | tm->move.nr_items = nr_items; |
@@ -699,7 +699,7 @@ tree_mod_log_insert_root(struct btrfs_fs_info *fs_info, | |||
699 | goto free_tms; | 699 | goto free_tms; |
700 | } | 700 | } |
701 | 701 | ||
702 | tm->index = new_root->start >> PAGE_CACHE_SHIFT; | 702 | tm->logical = new_root->start; |
703 | tm->old_root.logical = old_root->start; | 703 | tm->old_root.logical = old_root->start; |
704 | tm->old_root.level = btrfs_header_level(old_root); | 704 | tm->old_root.level = btrfs_header_level(old_root); |
705 | tm->generation = btrfs_header_generation(old_root); | 705 | tm->generation = btrfs_header_generation(old_root); |
@@ -739,16 +739,15 @@ __tree_mod_log_search(struct btrfs_fs_info *fs_info, u64 start, u64 min_seq, | |||
739 | struct rb_node *node; | 739 | struct rb_node *node; |
740 | struct tree_mod_elem *cur = NULL; | 740 | struct tree_mod_elem *cur = NULL; |
741 | struct tree_mod_elem *found = NULL; | 741 | struct tree_mod_elem *found = NULL; |
742 | u64 index = start >> PAGE_CACHE_SHIFT; | ||
743 | 742 | ||
744 | tree_mod_log_read_lock(fs_info); | 743 | tree_mod_log_read_lock(fs_info); |
745 | tm_root = &fs_info->tree_mod_log; | 744 | tm_root = &fs_info->tree_mod_log; |
746 | node = tm_root->rb_node; | 745 | node = tm_root->rb_node; |
747 | while (node) { | 746 | while (node) { |
748 | cur = container_of(node, struct tree_mod_elem, node); | 747 | cur = container_of(node, struct tree_mod_elem, node); |
749 | if (cur->index < index) { | 748 | if (cur->logical < start) { |
750 | node = node->rb_left; | 749 | node = node->rb_left; |
751 | } else if (cur->index > index) { | 750 | } else if (cur->logical > start) { |
752 | node = node->rb_right; | 751 | node = node->rb_right; |
753 | } else if (cur->seq < min_seq) { | 752 | } else if (cur->seq < min_seq) { |
754 | node = node->rb_left; | 753 | node = node->rb_left; |
@@ -1230,9 +1229,10 @@ __tree_mod_log_oldest_root(struct btrfs_fs_info *fs_info, | |||
1230 | return NULL; | 1229 | return NULL; |
1231 | 1230 | ||
1232 | /* | 1231 | /* |
1233 | * the very last operation that's logged for a root is the replacement | 1232 | * the very last operation that's logged for a root is the |
1234 | * operation (if it is replaced at all). this has the index of the *new* | 1233 | * replacement operation (if it is replaced at all). this has |
1235 | * root, making it the very first operation that's logged for this root. | 1234 | * the logical address of the *new* root, making it the very |
1235 | * first operation that's logged for this root. | ||
1236 | */ | 1236 | */ |
1237 | while (1) { | 1237 | while (1) { |
1238 | tm = tree_mod_log_search_oldest(fs_info, root_logical, | 1238 | tm = tree_mod_log_search_oldest(fs_info, root_logical, |
@@ -1336,7 +1336,7 @@ __tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, | |||
1336 | if (!next) | 1336 | if (!next) |
1337 | break; | 1337 | break; |
1338 | tm = container_of(next, struct tree_mod_elem, node); | 1338 | tm = container_of(next, struct tree_mod_elem, node); |
1339 | if (tm->index != first_tm->index) | 1339 | if (tm->logical != first_tm->logical) |
1340 | break; | 1340 | break; |
1341 | } | 1341 | } |
1342 | tree_mod_log_read_unlock(fs_info); | 1342 | tree_mod_log_read_unlock(fs_info); |
@@ -5361,7 +5361,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root, | |||
5361 | goto out; | 5361 | goto out; |
5362 | } | 5362 | } |
5363 | 5363 | ||
5364 | tmp_buf = kmalloc(left_root->nodesize, GFP_NOFS); | 5364 | tmp_buf = kmalloc(left_root->nodesize, GFP_KERNEL); |
5365 | if (!tmp_buf) { | 5365 | if (!tmp_buf) { |
5366 | ret = -ENOMEM; | 5366 | ret = -ENOMEM; |
5367 | goto out; | 5367 | goto out; |