📄 incore.h
字号:
/* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU General Public License version 2. */#ifndef __INCORE_DOT_H__#define __INCORE_DOT_H__#include <linux/fs.h>#include <linux/workqueue.h>#define DIO_WAIT 0x00000010#define DIO_METADATA 0x00000020#define DIO_ALL 0x00000100struct gfs2_log_operations;struct gfs2_log_element;struct gfs2_holder;struct gfs2_glock;struct gfs2_quota_data;struct gfs2_trans;struct gfs2_ail;struct gfs2_jdesc;struct gfs2_sbd;typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret);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; u32 lh_hash;};/* * Structure of operations that are associated with each * type of element in the log. */struct gfs2_log_operations { void (*lo_add) (struct gfs2_sbd *sdp, struct gfs2_log_element *le); void (*lo_incore_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr); void (*lo_before_commit) (struct gfs2_sbd *sdp); void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_ail *ai); 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;};struct gfs2_log_element { struct list_head le_list; const struct gfs2_log_operations *le_ops;};struct gfs2_bitmap { struct buffer_head *bi_bh; char *bi_clone; u32 bi_offset; u32 bi_start; u32 bi_len;};struct gfs2_rgrp_host { u32 rg_flags; u32 rg_free; u32 rg_dinodes; u64 rg_igeneration;};struct gfs2_rgrpd { struct list_head rd_list; /* Link with superblock */ struct list_head rd_list_mru; struct list_head rd_recent; /* Recently used rgrps */ 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 */ struct gfs2_rgrp_host rd_rg; u64 rd_rg_vn; struct gfs2_bitmap *rd_bits; unsigned int rd_bh_count; struct mutex rd_mutex; u32 rd_free_clone; struct gfs2_log_element rd_le; u32 rd_last_alloc_data; u32 rd_last_alloc_meta; struct gfs2_sbd *rd_sbd; unsigned long rd_flags;#define GFS2_RDF_CHECK 0x0001 /* Need to check for unlinked inodes */};enum gfs2_state_bits { BH_Pinned = BH_PrivateStart, BH_Escaped = BH_PrivateStart + 1,};BUFFER_FNS(Pinned, pinned)TAS_BUFFER_FNS(Pinned, pinned)BUFFER_FNS(Escaped, escaped)TAS_BUFFER_FNS(Escaped, escaped)struct gfs2_bufdata { struct buffer_head *bd_bh; struct gfs2_glock *bd_gl; union { struct list_head list_tr; u64 blkno; } u;#define bd_list_tr u.list_tr#define bd_blkno u.blkno struct gfs2_log_element bd_le; struct gfs2_ail *bd_ail; struct list_head bd_ail_st_list; struct list_head bd_ail_gl_list;};struct gfs2_glock_operations { void (*go_xmote_th) (struct gfs2_glock *gl); void (*go_xmote_bh) (struct gfs2_glock *gl); void (*go_drop_th) (struct gfs2_glock *gl); void (*go_inval) (struct gfs2_glock *gl, int flags); int (*go_demote_ok) (struct gfs2_glock *gl); int (*go_lock) (struct gfs2_holder *gh); void (*go_unlock) (struct gfs2_holder *gh); const int go_type; const unsigned long go_min_hold_time;};enum { /* Actions */ HIF_MUTEX = 0, HIF_PROMOTE = 1, /* States */ HIF_HOLDER = 6, HIF_FIRST = 7, HIF_ABORTED = 9, HIF_WAIT = 10,};struct gfs2_holder { struct list_head gh_list; struct gfs2_glock *gh_gl; pid_t gh_owner_pid; unsigned int gh_state; unsigned gh_flags; int gh_error; unsigned long gh_iflags; unsigned long gh_ip;};enum { GLF_LOCK = 1, GLF_STICKY = 2, GLF_DEMOTE = 3, GLF_PENDING_DEMOTE = 4, GLF_DIRTY = 5,};struct gfs2_glock { struct hlist_node gl_list; unsigned long gl_flags; /* GLF_... */ struct lm_lockname gl_name; atomic_t gl_ref; spinlock_t gl_spin; unsigned int gl_state; unsigned int gl_hash; unsigned int gl_demote_state; /* state requested by remote node */ unsigned long gl_demote_time; /* time of first demote request */ pid_t gl_owner_pid; unsigned long gl_ip; struct list_head gl_holders; struct list_head gl_waiters1; /* HIF_MUTEX */ struct list_head gl_waiters3; /* HIF_PROMOTE */ const struct gfs2_glock_operations *gl_ops; struct gfs2_holder *gl_req_gh; gfs2_glop_bh_t gl_req_bh; void *gl_lock; char *gl_lvb; atomic_t gl_lvb_count; u64 gl_vn; unsigned long gl_stamp; unsigned long gl_tchange; void *gl_object; struct list_head gl_reclaim; struct gfs2_sbd *gl_sbd; struct inode *gl_aspace; struct gfs2_log_element gl_le; struct list_head gl_ail_list; atomic_t gl_ail_count; struct delayed_work gl_work;};struct gfs2_alloc { /* Quota stuff */ struct gfs2_quota_data *al_qd[2*MAXQUOTAS]; struct gfs2_holder al_qd_ghs[2*MAXQUOTAS]; unsigned int al_qd_num; u32 al_requested; /* Filled in by caller of gfs2_inplace_reserve() */ u32 al_alloced; /* Filled in by gfs2_alloc_*() */ /* Filled in by gfs2_inplace_reserve() */ unsigned int al_line; char *al_file; struct gfs2_holder al_ri_gh; struct gfs2_holder al_rgd_gh; struct gfs2_rgrpd *al_rgd;};enum { GIF_INVALID = 0, GIF_QD_LOCKED = 1, GIF_PAGED = 2, GIF_SW_PAGED = 3,};struct gfs2_dinode_host { u64 di_size; /* number of bytes in file */ u64 di_blocks; /* number of blocks in file */ u64 di_goal_meta; /* rgrp to alloc from next */ u64 di_goal_data; /* data block goal */ u64 di_generation; /* generation number for NFS */ u32 di_flags; /* GFS2_DIF_... */ u16 di_height; /* height of metadata */ /* These only apply to directories */ u16 di_depth; /* Number of bits in the table */ u32 di_entries; /* The number of entries in the directory */ u64 di_eattr; /* extended attribute block number */};struct gfs2_inode { struct inode i_inode; u64 i_no_addr; u64 i_no_formal_ino; unsigned long i_flags; /* GIF_... */ struct gfs2_dinode_host i_di; /* To be replaced by ref to block */ struct gfs2_glock *i_gl; /* Move into i_gh? */ struct gfs2_holder i_iopen_gh; struct gfs2_holder i_gh; /* for prepare/commit_write only */ struct gfs2_alloc i_alloc; u64 i_last_rg_alloc; spinlock_t i_spin; struct rw_semaphore i_rw_mutex; unsigned long i_last_pfault; struct buffer_head *i_cache[GFS2_MAX_META_HEIGHT];};/* * Since i_inode is the first element of struct gfs2_inode, * this is effectively a cast. */static inline struct gfs2_inode *GFS2_I(struct inode *inode){ return container_of(inode, struct gfs2_inode, i_inode);}/* To be removed? */static inline struct gfs2_sbd *GFS2_SB(struct inode *inode){ return inode->i_sb->s_fs_info;}enum { GFF_DID_DIRECT_ALLOC = 0, GFF_EXLOCK = 1,};struct gfs2_file { unsigned long f_flags; /* GFF_... */ struct mutex f_fl_mutex; struct gfs2_holder f_fl_gh;};struct gfs2_revoke_replay { struct list_head rr_list; u64 rr_blkno; unsigned int rr_where;};enum { QDF_USER = 0, QDF_CHANGE = 1, QDF_LOCKED = 2,};struct gfs2_quota_data { struct list_head qd_list; unsigned int qd_count; u32 qd_id; unsigned long qd_flags; /* QDF_... */ s64 qd_change; s64 qd_change_sync; unsigned int qd_slot; unsigned int qd_slot_count; struct buffer_head *qd_bh; struct gfs2_quota_change *qd_bh_qc; unsigned int qd_bh_count; struct gfs2_glock *qd_gl; struct gfs2_quota_lvb qd_qb;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -