fs/gfs2/incore.h

Source file repositories/reference/linux-study-clean/fs/gfs2/incore.h

File Facts

System
Linux kernel
Corpus path
fs/gfs2/incore.h
Extension
.h
Size
23945 bytes
Lines
883
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 gfs2_log_header_host {
	u64 lh_sequence;	/* Sequence number of this transaction */
	u32 lh_flags;		/* GFS2_LOG_HEAD_... */
	u32 lh_tail;		/* Block number of log tail */
	u32 lh_blkno;

	s64 lh_local_total;
	s64 lh_local_free;
	s64 lh_local_dinodes;
};

/*
 * Structure of operations that are associated with each
 * type of element in the log.
 */

struct gfs2_log_operations {
	void (*lo_before_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
	void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
	void (*lo_before_scan) (struct gfs2_jdesc *jd,
				struct gfs2_log_header_host *head, int pass);
	int (*lo_scan_elements) (struct gfs2_jdesc *jd, unsigned int start,
				 struct gfs2_log_descriptor *ld, __be64 *ptr,
				 int pass);
	void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
	const char *lo_name;
};

#define GBF_FULL 1

/**
 * Clone bitmaps (bi_clone):
 *
 * - When a block is freed, we remember the previous state of the block in the
 *   clone bitmap, and only mark the block as free in the real bitmap.
 *
 * - When looking for a block to allocate, we check for a free block in the
 *   clone bitmap, and if no clone bitmap exists, in the real bitmap.
 *
 * - For allocating a block, we mark it as allocated in the real bitmap, and if
 *   a clone bitmap exists, also in the clone bitmap.
 *
 * - At the end of a log_flush, we copy the real bitmap into the clone bitmap
 *   to make the clone bitmap reflect the current allocation state.
 *   (Alternatively, we could remove the clone bitmap.)
 *
 * The clone bitmaps are in-core only, and is never written to disk.
 *
 * These steps ensure that blocks which have been freed in a transaction cannot
 * be reallocated in that same transaction.
 */
struct gfs2_bitmap {
	struct buffer_head *bi_bh;
	char *bi_clone;
	unsigned long bi_flags;
	u32 bi_offset;
	u32 bi_start;
	u32 bi_bytes;
	u32 bi_blocks;
};

struct gfs2_rgrpd {
	struct rb_node rd_node;		/* Link with superblock */
	struct gfs2_glock *rd_gl;	/* Glock for this rgrp */
	u64 rd_addr;			/* grp block disk address */
	u64 rd_data0;			/* first data location */
	u32 rd_length;			/* length of rgrp header in fs blocks */
	u32 rd_data;			/* num of data blocks in rgrp */
	u32 rd_bitbytes;		/* number of bytes in data bitmaps */
	u32 rd_free;
	u32 rd_requested;		/* number of blocks in rd_rstree */
	u32 rd_reserved;		/* number of reserved blocks */
	u32 rd_free_clone;
	u32 rd_dinodes;
	u64 rd_igeneration;
	struct gfs2_bitmap *rd_bits;
	struct gfs2_sbd *rd_sbd;
	struct gfs2_rgrp_lvb *rd_rgl;
	u32 rd_last_alloc;
	u32 rd_flags;
	u32 rd_extfail_pt;		/* extent failure point */
#define GFS2_RDF_CHECK		0x10000000 /* check for unlinked inodes */
#define GFS2_RDF_ERROR		0x40000000 /* error in rg */
#define GFS2_RDF_PREFERRED	0x80000000 /* This rgrp is preferred */
#define GFS2_RDF_MASK		0xf0000000 /* mask for internal flags */
	spinlock_t rd_rsspin;           /* protects reservation related vars */
	struct mutex rd_mutex;
	struct rb_root rd_rstree;       /* multi-block reservation tree */
};

Annotation

Implementation Notes