Lines Matching full:snapshot

11 #include "snapshot.h"
16 * Snapshot trees:
18 * Keys in BTREE_ID_snapshot_trees identify a whole tree of snapshot nodes; they
19 * exist to provide a stable identifier for the whole lifetime of a snapshot
28 prt_printf(out, "subvol %u root snapshot %u", in bch2_snapshot_tree_to_text()
92 /* Snapshot nodes: */
345 BTREE_ITER_WITH_UPDATES, snapshot, s); in bch2_snapshot_lookup()
358 bch_err(trans->c, "snapshot node %u not found", id); in bch2_snapshot_live()
366 * If @k is a snapshot with just one live child, it's part of a linear chain,
367 * which we consider to be an equivalence class: and then after snapshot
479 if (!bch2_snapshot_is_ancestor(c, le32_to_cpu(s.v->snapshot), snapshot_root)) in bch2_snapshot_tree_master_subvol()
534 "snapshot tree points to missing/incorrect snapshot:\n %s", in check_snapshot_tree()
547 "snapshot tree points to missing subvolume:\n %s", in check_snapshot_tree()
551 le32_to_cpu(subvol.snapshot), in check_snapshot_tree()
554 "snapshot tree points to subvolume that does not point to snapshot in this tree:\n %s", in check_snapshot_tree()
559 "snapshot tree points to snapshot subvolume:\n %s", in check_snapshot_tree()
584 * For each snapshot_tree, make sure it points to the root of a snapshot tree
585 * and that snapshot entry points back to it, or delete it.
587 * And, make sure it points to a subvolume within that snapshot tree, or correct
588 * it to point to the oldest subvolume within that snapshot tree.
603 * Look up snapshot tree for @tree_id and find root,
653 * snapshot_tree pointer was incorrect: look up root snapshot node, make sure
672 BTREE_ITER_WITH_UPDATES, snapshot); in snapshot_tree_ptr_repair()
684 u = bch2_bkey_make_mut_typed(trans, &root_iter, &root.s_c, 0, snapshot); in snapshot_tree_ptr_repair()
698 u = bch2_bkey_make_mut_typed(trans, iter, &k, 0, snapshot); in snapshot_tree_ptr_repair()
737 bch_err(c, "snapshot with nonexistent parent:\n %s", in check_snapshot()
744 bch_err(c, "snapshot parent %u missing pointer to child %llu", in check_snapshot()
756 bch_err(c, "snapshot node %llu has nonexistent child %u", in check_snapshot()
762 bch_err(c, "snapshot child %u has wrong parent (got %u should be %llu)", in check_snapshot()
776 bch_err(c, "snapshot points to nonexistent subvolume:\n %s", in check_snapshot()
781 if (BCH_SNAPSHOT_SUBVOL(&s) != (le32_to_cpu(subvol.snapshot) == k.k->p.offset)) { in check_snapshot()
782 bch_err(c, "snapshot node %llu has wrong BCH_SNAPSHOT_SUBVOL", in check_snapshot()
790 "snapshot should not point to subvol:\n %s", in check_snapshot()
792 u = bch2_bkey_make_mut_typed(trans, iter, &k, 0, snapshot); in check_snapshot()
807 "snapshot points to missing/incorrect tree:\n %s", in check_snapshot()
819 "snapshot with incorrect depth field, should be %u:\n %s", in check_snapshot()
821 u = bch2_bkey_make_mut_typed(trans, iter, &k, 0, snapshot); in check_snapshot()
835 "snapshot with bad skiplist field:\n %s", in check_snapshot()
837 u = bch2_bkey_make_mut_typed(trans, iter, &k, 0, snapshot); in check_snapshot()
872 * Mark a snapshot as deleted, for future cleanup:
882 0, snapshot); in bch2_snapshot_node_set_deleted()
886 trans->c, "missing snapshot %u", id); in bch2_snapshot_node_set_deleted()
920 BTREE_ITER_INTENT, snapshot); in bch2_snapshot_node_delete()
923 "missing snapshot %u", id); in bch2_snapshot_node_delete()
938 0, snapshot); in bch2_snapshot_node_delete()
941 "missing snapshot %u", parent_id); in bch2_snapshot_node_delete()
951 "snapshot %u missing child pointer to %u", in bch2_snapshot_node_delete()
965 0, snapshot); in bch2_snapshot_node_delete()
968 "missing snapshot %u", child_id); in bch2_snapshot_node_delete()
983 * We're deleting the root of a snapshot tree: update the in bch2_snapshot_node_delete()
985 * this is the last snapshot ID in this tree: in bch2_snapshot_node_delete()
1046 n = bch2_bkey_alloc(trans, &iter, 0, snapshot); in create_snapids()
1082 * Create new snapshot IDs as children of an existing snapshot ID:
1095 0, snapshot); in bch2_snapshot_node_create_children()
1099 bch_err(trans->c, "snapshot %u not found", parent); in bch2_snapshot_node_create_children()
1104 bch_err(trans->c, "Trying to add child snapshot nodes to parent that already has children"); in bch2_snapshot_node_create_children()
1124 * Create a snapshot node that is the root of a new tree:
1163 * If we have an unlinked inode in an internal snapshot node, and the inode
1170 * also: unlinked inode in internal snapshot appears to not be getting deleted
1175 * for a key in an interior snapshot node that needs work to be done that
1177 * that key to snapshot leaf nodes, where we can mutate it
1188 u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot); in snapshot_delete_key()
1194 if (snapshot_list_has_id(deleted, k.k->p.snapshot) || in snapshot_delete_key()
1208 u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot); in move_key_to_correct_snapshot()
1211 * When we have a linear chain of snapshot nodes, we consider in move_key_to_correct_snapshot()
1218 * snapshot - the rest have been overwritten and are redundant, in move_key_to_correct_snapshot()
1222 if (equiv != k.k->p.snapshot) { in move_key_to_correct_snapshot()
1231 new->k.p.snapshot = equiv; in move_key_to_correct_snapshot()
1276 * For a given snapshot, if it doesn't have a subvolume that points to it, and
1277 * it doesn't have child snapshot nodes - it's now redundant and we can mark it
1321 s = bch2_bkey_make_mut_noupdate_typed(trans, k, snapshot); in bch2_fix_child_of_deleted_snapshot()
1383 * For every snapshot node: If we have no live children and it's not in bch2_delete_dead_snapshots()
1455 u32 snapshot = k.k->p.offset; in bch2_delete_dead_snapshots()
1456 u32 equiv = bch2_snapshot_equiv(c, snapshot); in bch2_delete_dead_snapshots()
1458 equiv != snapshot in bch2_delete_dead_snapshots()
1459 ? snapshot_list_add(c, &deleted_interior, snapshot) in bch2_delete_dead_snapshots()
1482 bch_err_msg(c, ret, "deleting snapshot %u", *i); in bch2_delete_dead_snapshots()
1490 bch_err_msg(c, ret, "deleting snapshot %u", *i); in bch2_delete_dead_snapshots()
1543 if (bch2_snapshot_is_ancestor(c, k.k->p.snapshot, pos.snapshot)) { in __bch2_key_has_snapshot_overwrites()
1580 pos.snapshot = leaf_id; in bch2_propagate_key_to_snapshot_leaf()
1588 /* key already overwritten in this snapshot? */ in bch2_propagate_key_to_snapshot_leaf()
1589 if (k.k->p.snapshot != interior_k.k->p.snapshot) in bch2_propagate_key_to_snapshot_leaf()
1594 new_min_pos->snapshot = leaf_id; in bch2_propagate_key_to_snapshot_leaf()
1602 new->k.p.snapshot = leaf_id; in bch2_propagate_key_to_snapshot_leaf()
1625 for (u32 id = bch2_snapshot_smallest_descendent(c, k.k->p.snapshot); in bch2_propagate_key_to_snapshot_leaves()
1626 id < k.k->p.snapshot; in bch2_propagate_key_to_snapshot_leaves()
1628 if (!bch2_snapshot_is_ancestor(c, id, k.k->p.snapshot) || in bch2_propagate_key_to_snapshot_leaves()