fs/btrfs/delayed-ref.h

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

File Facts

System
Linux kernel
Corpus path
fs/btrfs/delayed-ref.h
Extension
.h
Size
13218 bytes
Lines
460
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_data_ref {
	/* For EXTENT_DATA_REF */

	/* Inode which refers to this data extent */
	u64 objectid;

	/*
	 * file_offset - extent_offset
	 *
	 * file_offset is the key.offset of the EXTENT_DATA key.
	 * extent_offset is btrfs_file_extent_offset() of the EXTENT_DATA data.
	 */
	u64 offset;
};

struct btrfs_tree_ref {
	/*
	 * Level of this tree block.
	 *
	 * Shared for skinny (TREE_BLOCK_REF) and normal tree ref.
	 */
	int level;

	/* For non-skinny metadata, no special member needed */
};

struct btrfs_delayed_ref_node {
	struct rb_node ref_node;
	/*
	 * If action is BTRFS_ADD_DELAYED_REF, also link this node to
	 * ref_head->ref_add_list, then we do not need to iterate the
	 * refs rbtree in the corresponding delayed ref head
	 * (struct btrfs_delayed_ref_head::ref_tree).
	 */
	struct list_head add_list;

	/* the starting bytenr of the extent */
	u64 bytenr;

	/* the size of the extent */
	u64 num_bytes;

	/* seq number to keep track of insertion order */
	u64 seq;

	/* The ref_root for this ref */
	u64 ref_root;

	/*
	 * The parent for this ref, if this isn't set the ref_root is the
	 * reference owner.
	 */
	u64 parent;

	/* ref count on this data structure */
	refcount_t refs;

	/*
	 * how many refs is this entry adding or deleting.  For
	 * head refs, this may be a negative number because it is keeping
	 * track of the total mods done to the reference count.
	 * For individual refs, this will always be a positive number
	 *
	 * It may be more than one, since it is possible for a single
	 * parent to have more than one ref on an extent
	 */
	int ref_mod;

	unsigned int action:8;
	unsigned int type:8;

	union {
		struct btrfs_tree_ref tree_ref;
		struct btrfs_data_ref data_ref;
	};
};

struct btrfs_delayed_extent_op {
	struct btrfs_disk_key key;
	bool update_key;
	bool update_flags;
	u64 flags_to_set;
};

/*
 * the head refs are used to hold a lock on a given extent, which allows us
 * to make sure that only one process is running the delayed refs
 * at a time for a single extent.  They also store the sum of all the
 * reference count modifications we've queued up.
 */

Annotation

Implementation Notes