fs/xfs/xfs_trans.h

Source file repositories/reference/linux-study-clean/fs/xfs/xfs_trans.h

File Facts

System
Linux kernel
Corpus path
fs/xfs/xfs_trans.h
Extension
.h
Size
9798 bytes
Lines
284
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 xfs_log_item {
	struct list_head		li_ail;		/* AIL pointers */
	struct list_head		li_trans;	/* transaction list */
	xfs_lsn_t			li_lsn;		/* last on-disk lsn */
	struct xlog			*li_log;
	struct xfs_ail			*li_ailp;	/* ptr to AIL */
	uint				li_type;	/* item type */
	unsigned long			li_flags;	/* misc flags */
	struct xfs_buf			*li_buf;	/* real buffer pointer */
	struct list_head		li_bio_list;	/* buffer item list */
	const struct xfs_item_ops	*li_ops;	/* function list */

	/* delayed logging */
	struct list_head		li_cil;		/* CIL pointers */
	struct xfs_log_vec		*li_lv;		/* active log vector */
	struct xfs_log_vec		*li_lv_shadow;	/* standby vector */
	xfs_csn_t			li_seq;		/* CIL commit seq */
	uint32_t			li_order_id;	/* CIL commit order */
};

/*
 * li_flags use the (set/test/clear)_bit atomic interfaces because updates can
 * race with each other and we don't want to have to use the AIL lock to
 * serialise all updates.
 */
#define	XFS_LI_IN_AIL	0
#define	XFS_LI_ABORTED	1
#define	XFS_LI_FAILED	2
#define	XFS_LI_DIRTY	3
#define	XFS_LI_WHITEOUT	4
#define	XFS_LI_FLUSHING	5

#define XFS_LI_FLAGS \
	{ (1u << XFS_LI_IN_AIL),	"IN_AIL" }, \
	{ (1u << XFS_LI_ABORTED),	"ABORTED" }, \
	{ (1u << XFS_LI_FAILED),	"FAILED" }, \
	{ (1u << XFS_LI_DIRTY),		"DIRTY" }, \
	{ (1u << XFS_LI_WHITEOUT),	"WHITEOUT" }, \
	{ (1u << XFS_LI_FLUSHING),	"FLUSHING" }

struct xfs_item_ops {
	unsigned flags;
	void (*iop_size)(struct xfs_log_item *, int *, int *);
	void (*iop_format)(struct xfs_log_item *lip,
			struct xlog_format_buf *lfb);
	void (*iop_pin)(struct xfs_log_item *);
	void (*iop_unpin)(struct xfs_log_item *, int remove);
	uint64_t (*iop_sort)(struct xfs_log_item *lip);
	int (*iop_precommit)(struct xfs_trans *tp, struct xfs_log_item *lip);
	void (*iop_committing)(struct xfs_log_item *lip, xfs_csn_t seq);
	xfs_lsn_t (*iop_committed)(struct xfs_log_item *, xfs_lsn_t);
	uint (*iop_push)(struct xfs_log_item *, struct list_head *);
	void (*iop_release)(struct xfs_log_item *);
	bool (*iop_match)(struct xfs_log_item *item, uint64_t id);
	struct xfs_log_item *(*iop_intent)(struct xfs_log_item *intent_done);
};

/*
 * Log item ops flags
 */
/*
 * Release the log item when the journal commits instead of inserting into the
 * AIL for writeback tracking and/or log tail pinning.
 */
#define XFS_ITEM_RELEASE_WHEN_COMMITTED	(1 << 0)
#define XFS_ITEM_INTENT			(1 << 1)
#define XFS_ITEM_INTENT_DONE		(1 << 2)

static inline bool
xlog_item_is_intent(struct xfs_log_item *lip)
{
	return lip->li_ops->flags & XFS_ITEM_INTENT;
}

static inline bool
xlog_item_is_intent_done(struct xfs_log_item *lip)
{
	return lip->li_ops->flags & XFS_ITEM_INTENT_DONE;
}

void	xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
			  int type, const struct xfs_item_ops *ops);

/*
 * Return values for the iop_push() routines.
 */
#define XFS_ITEM_SUCCESS	0
#define XFS_ITEM_PINNED		1
#define XFS_ITEM_LOCKED		2
#define XFS_ITEM_FLUSHING	3

Annotation

Implementation Notes