/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. */ #ifndef __INCORE_DOT_H__ #define __INCORE_DOT_H__ #include <linux/fs.h> #include <linux/kobject.h> #include <linux/workqueue.h> #include <linux/dlm.h> #include <linux/buffer_head.h> #include <linux/rcupdate.h> #include <linux/rculist_bl.h> #include <linux/completion.h> #include <linux/rbtree.h> #include <linux/ktime.h> #include <linux/percpu.h> #include <linux/lockref.h> #include <linux/rhashtable.h> #include <linux/mutex.h> #define DIO_WAIT … #define DIO_METADATA … struct gfs2_log_operations; struct gfs2_bufdata; struct gfs2_holder; struct gfs2_glock; struct gfs2_quota_data; struct gfs2_trans; struct gfs2_jdesc; struct gfs2_sbd; struct lm_lockops; gfs2_glop_bh_t; struct gfs2_log_header_host { … }; /* * Structure of operations that are associated with each * type of element in the log. */ struct gfs2_log_operations { … }; #define GBF_FULL … /** * 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 gfs2_rgrpd { … }; enum gfs2_state_bits { … }; BUFFER_FNS(Pinned, pinned) TAS_BUFFER_FNS(Pinned, pinned) BUFFER_FNS(Escaped, escaped) TAS_BUFFER_FNS(Escaped, escaped) struct gfs2_bufdata { … }; /* * Internally, we prefix things with gdlm_ and GDLM_ (for gfs-dlm) since a * prefix of lock_dlm_ gets awkward. */ #define GDLM_STRNAME_BYTES … #define GDLM_LVB_SIZE … /* * ls_recover_flags: * * DFL_BLOCK_LOCKS: dlm is in recovery and will grant locks that had been * held by failed nodes whose journals need recovery. Those locks should * only be used for journal recovery until the journal recovery is done. * This is set by the dlm recover_prep callback and cleared by the * gfs2_control thread when journal recovery is complete. To avoid * races between recover_prep setting and gfs2_control clearing, recover_spin * is held while changing this bit and reading/writing recover_block * and recover_start. * * DFL_NO_DLM_OPS: dlm lockspace ops/callbacks are not being used. * * DFL_FIRST_MOUNT: this node is the first to mount this fs and is doing * recovery of all journals before allowing other nodes to mount the fs. * This is cleared when FIRST_MOUNT_DONE is set. * * DFL_FIRST_MOUNT_DONE: this node was the first mounter, and has finished * recovery of all journals, and now allows other nodes to mount the fs. * * DFL_MOUNT_DONE: gdlm_mount has completed successfully and cleared * BLOCK_LOCKS for the first time. The gfs2_control thread should now * control clearing BLOCK_LOCKS for further recoveries. * * DFL_UNMOUNT: gdlm_unmount sets to keep sdp off gfs2_control_wq. * * DFL_DLM_RECOVERY: set while dlm is in recovery, between recover_prep() * and recover_done(), i.e. set while recover_block == recover_start. */ enum { … }; /* * We are using struct lm_lockname as an rhashtable key. Avoid holes within * the struct; padding at the end is fine. */ struct lm_lockname { … }; #define lm_name_equal(name1, name2) … struct gfs2_glock_operations { … }; enum { … }; struct gfs2_lkstats { … }; enum { … }; struct gfs2_holder { … }; /* Number of quota types we support */ #define GFS2_MAXQUOTAS … struct gfs2_qadata { … }; /* Resource group multi-block reservation, in order of appearance: Step 1. Function prepares to write, allocates a mb, sets the size hint. Step 2. User calls inplace_reserve to target an rgrp, sets the rgrp info Step 3. Function get_local_rgrp locks the rgrp, determines which bits to use Step 4. Bits are assigned from the rgrp based on either the reservation or wherever it can. */ struct gfs2_blkreserv { … }; /* * Allocation parameters * @target: The number of blocks we'd ideally like to allocate * @aflags: The flags (e.g. Orlov flag) * * The intent is to gradually expand this structure over time in * order to give more information, e.g. alignment, min extent size * to the allocation code. */ struct gfs2_alloc_parms { … }; enum { … }; struct gfs2_glock { … }; enum { … }; struct gfs2_inode { … }; /* * 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) { … } static inline struct gfs2_sbd *GFS2_SB(const struct inode *inode) { … } struct gfs2_file { … }; struct gfs2_revoke_replay { … }; enum { … }; struct gfs2_quota_data { … }; enum { … }; struct gfs2_trans { … }; struct gfs2_journal_extent { … }; struct gfs2_jdesc { … }; struct gfs2_statfs_change_host { … }; #define GFS2_QUOTA_DEFAULT … #define GFS2_QUOTA_OFF … #define GFS2_QUOTA_ACCOUNT … #define GFS2_QUOTA_ON … #define GFS2_QUOTA_QUIET … #define GFS2_DATA_DEFAULT … #define GFS2_DATA_WRITEBACK … #define GFS2_DATA_ORDERED … #define GFS2_ERRORS_DEFAULT … #define GFS2_ERRORS_WITHDRAW … #define GFS2_ERRORS_CONTINUE … #define GFS2_ERRORS_RO … #define GFS2_ERRORS_PANIC … struct gfs2_args { … }; struct gfs2_tune { … }; enum { … }; #define GFS2_FSNAME_LEN … struct gfs2_inum_host { … }; struct gfs2_sb_host { … }; /* * lm_mount() return values * * ls_jid - the journal ID this node should use * ls_first - this node is the first to mount the file system * ls_lockspace - lock module's context for this file system * ls_ops - lock module's functions */ struct lm_lockstruct { … }; struct gfs2_pcpu_lkstats { … }; /* List of local (per node) statfs inodes */ struct local_statfs_inode { … }; struct gfs2_sbd { … }; static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which) { … } static inline void gfs2_sbstats_inc(const struct gfs2_glock *gl, int which) { … } struct gfs2_rgrpd *gfs2_glock2rgrp(struct gfs2_glock *gl); static inline unsigned gfs2_max_stuffed_size(const struct gfs2_inode *ip) { … } #endif /* __INCORE_DOT_H__ */