Lines Matching full:tm
76 struct tree_mod_elem *tm; in btrfs_put_tree_mod_seq() local
112 tm = rb_entry(node, struct tree_mod_elem, node); in btrfs_put_tree_mod_seq()
113 if (tm->seq >= min_seq) in btrfs_put_tree_mod_seq()
116 kfree(tm); in btrfs_put_tree_mod_seq()
130 struct tree_mod_elem *tm) in tree_mod_log_insert() argument
139 tm->seq = btrfs_inc_tree_mod_seq(fs_info); in tree_mod_log_insert()
146 if (cur->logical < tm->logical) in tree_mod_log_insert()
148 else if (cur->logical > tm->logical) in tree_mod_log_insert()
150 else if (cur->seq < tm->seq) in tree_mod_log_insert()
152 else if (cur->seq > tm->seq) in tree_mod_log_insert()
158 rb_link_node(&tm->node, parent, new); in tree_mod_log_insert()
159 rb_insert_color(&tm->node, tm_root); in tree_mod_log_insert()
203 struct tree_mod_elem *tm; in alloc_tree_mod_elem() local
205 tm = kzalloc(sizeof(*tm), flags); in alloc_tree_mod_elem()
206 if (!tm) in alloc_tree_mod_elem()
209 tm->logical = eb->start; in alloc_tree_mod_elem()
211 btrfs_node_key(eb, &tm->key, slot); in alloc_tree_mod_elem()
212 tm->blockptr = btrfs_node_blockptr(eb, slot); in alloc_tree_mod_elem()
214 tm->op = op; in alloc_tree_mod_elem()
215 tm->slot = slot; in alloc_tree_mod_elem()
216 tm->generation = btrfs_node_ptr_generation(eb, slot); in alloc_tree_mod_elem()
217 RB_CLEAR_NODE(&tm->node); in alloc_tree_mod_elem()
219 return tm; in alloc_tree_mod_elem()
225 struct tree_mod_elem *tm; in btrfs_tree_mod_log_insert_key() local
231 tm = alloc_tree_mod_elem(eb, slot, op, flags); in btrfs_tree_mod_log_insert_key()
232 if (!tm) in btrfs_tree_mod_log_insert_key()
236 kfree(tm); in btrfs_tree_mod_log_insert_key()
240 ret = tree_mod_log_insert(eb->fs_info, tm); in btrfs_tree_mod_log_insert_key()
243 kfree(tm); in btrfs_tree_mod_log_insert_key()
252 struct tree_mod_elem *tm = NULL; in btrfs_tree_mod_log_insert_move() local
265 tm = kzalloc(sizeof(*tm), GFP_NOFS); in btrfs_tree_mod_log_insert_move()
266 if (!tm) { in btrfs_tree_mod_log_insert_move()
271 tm->logical = eb->start; in btrfs_tree_mod_log_insert_move()
272 tm->slot = src_slot; in btrfs_tree_mod_log_insert_move()
273 tm->move.dst_slot = dst_slot; in btrfs_tree_mod_log_insert_move()
274 tm->move.nr_items = nr_items; in btrfs_tree_mod_log_insert_move()
275 tm->op = BTRFS_MOD_LOG_MOVE_KEYS; in btrfs_tree_mod_log_insert_move()
301 ret = tree_mod_log_insert(eb->fs_info, tm); in btrfs_tree_mod_log_insert_move()
318 kfree(tm); in btrfs_tree_mod_log_insert_move()
348 struct tree_mod_elem *tm = NULL; in btrfs_tree_mod_log_insert_root() local
375 tm = kzalloc(sizeof(*tm), GFP_NOFS); in btrfs_tree_mod_log_insert_root()
376 if (!tm) { in btrfs_tree_mod_log_insert_root()
381 tm->logical = new_root->start; in btrfs_tree_mod_log_insert_root()
382 tm->old_root.logical = old_root->start; in btrfs_tree_mod_log_insert_root()
383 tm->old_root.level = btrfs_header_level(old_root); in btrfs_tree_mod_log_insert_root()
384 tm->generation = btrfs_header_generation(old_root); in btrfs_tree_mod_log_insert_root()
385 tm->op = BTRFS_MOD_LOG_ROOT_REPLACE; in btrfs_tree_mod_log_insert_root()
393 ret = tree_mod_log_insert(fs_info, tm); in btrfs_tree_mod_log_insert_root()
408 kfree(tm); in btrfs_tree_mod_log_insert_root()
600 struct tree_mod_elem *tm; in tree_mod_log_oldest_root() local
615 tm = tree_mod_log_search_oldest(eb_root->fs_info, root_logical, in tree_mod_log_oldest_root()
617 if (!looped && !tm) in tree_mod_log_oldest_root()
624 if (!tm) in tree_mod_log_oldest_root()
632 if (tm->op != BTRFS_MOD_LOG_ROOT_REPLACE) in tree_mod_log_oldest_root()
635 found = tm; in tree_mod_log_oldest_root()
636 root_logical = tm->old_root.logical; in tree_mod_log_oldest_root()
642 found = tm; in tree_mod_log_oldest_root()
649 * tm is a pointer to the first operation to rewind within eb. Then, all
660 struct tree_mod_elem *tm = first_tm; in tree_mod_log_rewind() local
667 while (tm && tm->seq >= time_seq) { in tree_mod_log_rewind()
673 switch (tm->op) { in tree_mod_log_rewind()
675 BUG_ON(tm->slot < n); in tree_mod_log_rewind()
679 btrfs_set_node_key(eb, &tm->key, tm->slot); in tree_mod_log_rewind()
680 btrfs_set_node_blockptr(eb, tm->slot, tm->blockptr); in tree_mod_log_rewind()
681 btrfs_set_node_ptr_generation(eb, tm->slot, in tree_mod_log_rewind()
682 tm->generation); in tree_mod_log_rewind()
686 BUG_ON(tm->slot >= n); in tree_mod_log_rewind()
687 btrfs_set_node_key(eb, &tm->key, tm->slot); in tree_mod_log_rewind()
688 btrfs_set_node_blockptr(eb, tm->slot, tm->blockptr); in tree_mod_log_rewind()
689 btrfs_set_node_ptr_generation(eb, tm->slot, in tree_mod_log_rewind()
690 tm->generation); in tree_mod_log_rewind()
697 o_dst = btrfs_node_key_ptr_offset(tm->slot); in tree_mod_log_rewind()
698 o_src = btrfs_node_key_ptr_offset(tm->move.dst_slot); in tree_mod_log_rewind()
700 tm->move.nr_items * p_size); in tree_mod_log_rewind()
714 next = rb_next(&tm->node); in tree_mod_log_rewind()
717 tm = rb_entry(next, struct tree_mod_elem, node); in tree_mod_log_rewind()
718 if (tm->logical != first_tm->logical) in tree_mod_log_rewind()
738 struct tree_mod_elem *tm; in btrfs_tree_mod_log_rewind() local
746 tm = tree_mod_log_search(fs_info, eb->start, time_seq); in btrfs_tree_mod_log_rewind()
747 if (!tm) in btrfs_tree_mod_log_rewind()
750 if (tm->op == BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING) { in btrfs_tree_mod_log_rewind()
751 BUG_ON(tm->slot != 0); in btrfs_tree_mod_log_rewind()
778 tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm); in btrfs_tree_mod_log_rewind()
795 struct tree_mod_elem *tm; in btrfs_get_old_root() local
806 tm = tree_mod_log_oldest_root(eb_root, time_seq); in btrfs_get_old_root()
807 if (!tm) in btrfs_get_old_root()
810 if (tm->op == BTRFS_MOD_LOG_ROOT_REPLACE) { in btrfs_get_old_root()
811 old_root = &tm->old_root; in btrfs_get_old_root()
812 old_generation = tm->generation; in btrfs_get_old_root()
820 tm = tree_mod_log_search(fs_info, logical, time_seq); in btrfs_get_old_root()
821 if (old_root && tm && tm->op != BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING) { in btrfs_get_old_root()
851 ASSERT(tm2 == tm || tm2->seq > tm->seq); in btrfs_get_old_root()
852 if (!tm2 || tm2->seq < tm->seq) { in btrfs_get_old_root()
856 tm = tm2; in btrfs_get_old_root()
881 if (tm) in btrfs_get_old_root()
882 tree_mod_log_rewind(fs_info, eb, time_seq, tm); in btrfs_get_old_root()
892 struct tree_mod_elem *tm; in btrfs_old_root_level() local
896 tm = tree_mod_log_oldest_root(eb_root, time_seq); in btrfs_old_root_level()
897 if (tm && tm->op == BTRFS_MOD_LOG_ROOT_REPLACE) in btrfs_old_root_level()
898 level = tm->old_root.level; in btrfs_old_root_level()