fs/btrfs/backref.h

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

File Facts

System
Linux kernel
Corpus path
fs/btrfs/backref.h
Extension
.h
Size
15618 bytes
Lines
470
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_backref_walk_ctx {
	/*
	 * The address of the extent for which we are doing backref walking.
	 * Can be either a data extent or a metadata extent.
	 *
	 * Must always be set by the top level caller.
	 */
	u64 bytenr;
	/*
	 * Offset relative to the target extent. This is only used for data
	 * extents, and it's meaningful because we can have file extent items
	 * that point only to a section of a data extent ("bookend" extents),
	 * and we want to filter out any that don't point to a section of the
	 * data extent containing the given offset.
	 *
	 * Must always be set by the top level caller.
	 */
	u64 extent_item_pos;
	/*
	 * If true and bytenr corresponds to a data extent, then references from
	 * all file extent items that point to the data extent are considered,
	 * @extent_item_pos is ignored.
	 */
	bool ignore_extent_item_pos;
	/*
	 * If true and bytenr corresponds to a data extent, then the inode list
	 * (each member describing inode number, file offset and root) is not
	 * added to each reference added to the @refs ulist.
	 */
	bool skip_inode_ref_list;
	/* A valid transaction handle or NULL. */
	struct btrfs_trans_handle *trans;
	/*
	 * The file system's info object, can not be NULL.
	 *
	 * Must always be set by the top level caller.
	 */
	struct btrfs_fs_info *fs_info;
	/*
	 * Time sequence acquired from btrfs_get_tree_mod_seq(), in case the
	 * caller joined the tree mod log to get a consistent view of b+trees
	 * while we do backref walking, or BTRFS_SEQ_LAST.
	 * When using BTRFS_SEQ_LAST, delayed refs are not checked and it uses
	 * commit roots when searching b+trees - this is a special case for
	 * qgroups used during a transaction commit.
	 */
	u64 time_seq;
	/*
	 * Used to collect the bytenr of metadata extents that point to the
	 * target extent.
	 */
	struct ulist *refs;
	/*
	 * List used to collect the IDs of the roots from which the target
	 * extent is accessible. Can be NULL in case the caller does not care
	 * about collecting root IDs.
	 */
	struct ulist *roots;
	/*
	 * Used by iterate_extent_inodes() and the main backref walk code
	 * (find_parent_nodes()). Lookup and store functions for an optional
	 * cache which maps the logical address (bytenr) of leaves to an array
	 * of root IDs.
	 */
	bool (*cache_lookup)(u64 leaf_bytenr, void *user_ctx,
			     const u64 **root_ids_ret, int *root_count_ret);
	void (*cache_store)(u64 leaf_bytenr, const struct ulist *root_ids,
			    void *user_ctx);
	/*
	 * If this is not NULL, then the backref walking code will call this
	 * for each indirect data extent reference as soon as it finds one,
	 * before collecting all the remaining backrefs and before resolving
	 * indirect backrefs. This allows for the caller to terminate backref
	 * walking as soon as it finds one backref that matches some specific
	 * criteria. The @cache_lookup and @cache_store callbacks should not
	 * be NULL in order to use this callback.
	 */
	iterate_extent_inodes_t *indirect_ref_iterator;
	/*
	 * If this is not NULL, then the backref walking code will call this for
	 * each extent item it's meant to process before it actually starts
	 * processing it. If this returns anything other than 0, then it stops
	 * the backref walking code immediately.
	 */
	int (*check_extent_item)(u64 bytenr, const struct btrfs_extent_item *ei,
				 const struct extent_buffer *leaf, void *user_ctx);
	/*
	 * If this is not NULL, then the backref walking code will call this for
	 * each extent data ref it finds (BTRFS_EXTENT_DATA_REF_KEY keys) before
	 * processing that data ref. If this callback return false, then it will

Annotation

Implementation Notes