fs/btrfs/tree-checker.h

Source file repositories/reference/linux-study-clean/fs/btrfs/tree-checker.h

File Facts

System
Linux kernel
Corpus path
fs/btrfs/tree-checker.h
Extension
.h
Size
2294 bytes
Lines
84
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct btrfs_tree_parent_check {
	/*
	 * The owner check against the tree block.
	 *
	 * Can be 0 to skip the owner check.
	 */
	u64 owner_root;

	/*
	 * Expected transid, can be 0 to skip the check, but such skip
	 * should only be utilized for backref walk related code.
	 */
	u64 transid;

	/*
	 * The expected first key.
	 *
	 * This check can be skipped if @has_first_key is false, such skip
	 * can happen for case where we don't have the parent node key,
	 * e.g. reading the tree root, doing backref walk.
	 */
	struct btrfs_key first_key;
	bool has_first_key;

	/* The expected level. Should always be set. */
	u8 level;
};

enum btrfs_tree_block_status {
	BTRFS_TREE_BLOCK_CLEAN,
	BTRFS_TREE_BLOCK_INVALID_NRITEMS,
	BTRFS_TREE_BLOCK_INVALID_PARENT_KEY,
	BTRFS_TREE_BLOCK_BAD_KEY_ORDER,
	BTRFS_TREE_BLOCK_INVALID_LEVEL,
	BTRFS_TREE_BLOCK_INVALID_FREE_SPACE,
	BTRFS_TREE_BLOCK_INVALID_OFFSETS,
	BTRFS_TREE_BLOCK_INVALID_BLOCKPTR,
	BTRFS_TREE_BLOCK_INVALID_ITEM,
	BTRFS_TREE_BLOCK_INVALID_OWNER,
	BTRFS_TREE_BLOCK_WRITTEN_NOT_SET,
};


#define BTRFS_BLOCK_GROUP_VALID	(BTRFS_BLOCK_GROUP_TYPE_MASK | \
				 BTRFS_BLOCK_GROUP_PROFILE_MASK | \
				 BTRFS_BLOCK_GROUP_REMAPPED)

/*
 * Exported simply for btrfs-progs which wants to have the
 * btrfs_tree_block_status return codes.
 */
enum btrfs_tree_block_status __btrfs_check_leaf(struct extent_buffer *leaf);
enum btrfs_tree_block_status __btrfs_check_node(struct extent_buffer *node);

int btrfs_check_leaf(struct extent_buffer *leaf);
int btrfs_check_node(struct extent_buffer *node);

int btrfs_check_chunk_valid(const struct btrfs_fs_info *fs_info,
			    const struct extent_buffer *leaf,
			    const struct btrfs_chunk *chunk, u64 logical,
			    u32 sectorsize);
int btrfs_check_eb_owner(const struct extent_buffer *eb, u64 root_owner);
int btrfs_verify_level_key(struct extent_buffer *eb,
			   const struct btrfs_tree_parent_check *check);

#endif

Annotation

Implementation Notes