fs/xfs/xfs_log_priv.h

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

File Facts

System
Linux kernel
Corpus path
fs/xfs/xfs_log_priv.h
Extension
.h
Size
27367 bytes
Lines
748
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_iovec {
	void			*i_addr;/* beginning address of region */
	int			i_len;	/* length in bytes of region */
	uint			i_type;	/* type of region */
};

struct xfs_log_vec {
	struct list_head	lv_list;	/* CIL lv chain ptrs */
	uint32_t		lv_order_id;	/* chain ordering info */
	int			lv_niovecs;	/* number of iovecs in lv */
	struct xfs_log_iovec	*lv_iovecp;	/* iovec array */
	struct xfs_log_item	*lv_item;	/* owner */
	char			*lv_buf;	/* formatted buffer */
	int			lv_bytes;	/* accounted space in buffer */
	int			lv_buf_used;	/* buffer space used so far */
	int			lv_alloc_size;	/* size of allocated lv */
};

/*
 * get client id from packed copy.
 *
 * this hack is here because the xlog_pack code copies four bytes
 * of xlog_op_header containing the fields oh_clientid, oh_flags
 * and oh_res2 into the packed copy.
 *
 * later on this four byte chunk is treated as an int and the
 * client id is pulled out.
 *
 * this has endian issues, of course.
 */
static inline uint xlog_get_client_id(__be32 i)
{
	return be32_to_cpu(i) >> 24;
}

/*
 * In core log state
 */
enum xlog_iclog_state {
	XLOG_STATE_ACTIVE,	/* Current IC log being written to */
	XLOG_STATE_WANT_SYNC,	/* Want to sync this iclog; no more writes */
	XLOG_STATE_SYNCING,	/* This IC log is syncing */
	XLOG_STATE_DONE_SYNC,	/* Done syncing to disk */
	XLOG_STATE_CALLBACK,	/* Callback functions now */
	XLOG_STATE_DIRTY,	/* Dirty IC log, not ready for ACTIVE status */
};

#define XLOG_STATE_STRINGS \
	{ XLOG_STATE_ACTIVE,	"XLOG_STATE_ACTIVE" }, \
	{ XLOG_STATE_WANT_SYNC,	"XLOG_STATE_WANT_SYNC" }, \
	{ XLOG_STATE_SYNCING,	"XLOG_STATE_SYNCING" }, \
	{ XLOG_STATE_DONE_SYNC,	"XLOG_STATE_DONE_SYNC" }, \
	{ XLOG_STATE_CALLBACK,	"XLOG_STATE_CALLBACK" }, \
	{ XLOG_STATE_DIRTY,	"XLOG_STATE_DIRTY" }

/*
 * In core log flags
 */
#define XLOG_ICL_NEED_FLUSH	(1u << 0)	/* iclog needs REQ_PREFLUSH */
#define XLOG_ICL_NEED_FUA	(1u << 1)	/* iclog needs REQ_FUA */

#define XLOG_ICL_STRINGS \
	{ XLOG_ICL_NEED_FLUSH,	"XLOG_ICL_NEED_FLUSH" }, \
	{ XLOG_ICL_NEED_FUA,	"XLOG_ICL_NEED_FUA" }


/*
 * Log ticket flags
 */
#define XLOG_TIC_PERM_RESERV	(1u << 0)	/* permanent reservation */

#define XLOG_TIC_FLAGS \
	{ XLOG_TIC_PERM_RESERV,	"XLOG_TIC_PERM_RESERV" }

/*
 * Below are states for covering allocation transactions.
 * By covering, we mean changing the h_tail_lsn in the last on-disk
 * log write such that no allocation transactions will be re-done during
 * recovery after a system crash. Recovery starts at the last on-disk
 * log write.
 *
 * These states are used to insert dummy log entries to cover
 * space allocation transactions which can undo non-transactional changes
 * after a crash. Writes to a file with space
 * already allocated do not result in any transactions. Allocations
 * might include space beyond the EOF. So if we just push the EOF a
 * little, the last transaction for the file could contain the wrong
 * size. If there is no file system activity, after an allocation
 * transaction, and the system crashes, the allocation transaction
 * will get replayed and the file will be truncated. This could

Annotation

Implementation Notes