📄 ocfs2.h
字号:
/* -*- mode: c; c-basic-offset: 8; -*- * vim: noexpandtab sw=8 ts=8 sts=0: * * ocfs2.h * * Defines macros and structures used in OCFS2 * * Copyright (C) 2002, 2004 Oracle. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */#ifndef OCFS2_H#define OCFS2_H#include <linux/spinlock.h>#include <linux/sched.h>#include <linux/wait.h>#include <linux/list.h>#include <linux/rbtree.h>#include <linux/workqueue.h>#include <linux/kref.h>#include <linux/mutex.h>#include <linux/jbd.h>#include "cluster/nodemanager.h"#include "cluster/heartbeat.h"#include "cluster/tcp.h"#include "dlm/dlmapi.h"#include "ocfs2_fs.h"#include "ocfs2_lockid.h"/* Most user visible OCFS2 inodes will have very few pieces of * metadata, but larger files (including bitmaps, etc) must be taken * into account when designing an access scheme. We allow a small * amount of inlined blocks to be stored on an array and grow the * structure into a rb tree when necessary. */#define OCFS2_INODE_MAX_CACHE_ARRAY 2struct ocfs2_caching_info { unsigned int ci_num_cached; union { sector_t ci_array[OCFS2_INODE_MAX_CACHE_ARRAY]; struct rb_root ci_tree; } ci_cache;};/* this limits us to 256 nodes * if we need more, we can do a kmalloc for the map */#define OCFS2_NODE_MAP_MAX_NODES 256struct ocfs2_node_map { u16 num_nodes; unsigned long map[BITS_TO_LONGS(OCFS2_NODE_MAP_MAX_NODES)];};enum ocfs2_ast_action { OCFS2_AST_INVALID = 0, OCFS2_AST_ATTACH, OCFS2_AST_CONVERT, OCFS2_AST_DOWNCONVERT,};/* actions for an unlockast function to take. */enum ocfs2_unlock_action { OCFS2_UNLOCK_INVALID = 0, OCFS2_UNLOCK_CANCEL_CONVERT, OCFS2_UNLOCK_DROP_LOCK,};/* ocfs2_lock_res->l_flags flags. */#define OCFS2_LOCK_ATTACHED (0x00000001) /* have we initialized * the lvb */#define OCFS2_LOCK_BUSY (0x00000002) /* we are currently in * dlm_lock */#define OCFS2_LOCK_BLOCKED (0x00000004) /* blocked waiting to * downconvert*/#define OCFS2_LOCK_LOCAL (0x00000008) /* newly created inode */#define OCFS2_LOCK_NEEDS_REFRESH (0x00000010)#define OCFS2_LOCK_REFRESHING (0x00000020)#define OCFS2_LOCK_INITIALIZED (0x00000040) /* track initialization * for shutdown paths */#define OCFS2_LOCK_FREEING (0x00000080) /* help dlmglue track * when to skip queueing * a lock because it's * about to be * dropped. */#define OCFS2_LOCK_QUEUED (0x00000100) /* queued for downconvert */#define OCFS2_LOCK_NOCACHE (0x00000200) /* don't use a holder count */struct ocfs2_lock_res_ops;typedef void (*ocfs2_lock_callback)(int status, unsigned long data);struct ocfs2_lock_res { void *l_priv; struct ocfs2_lock_res_ops *l_ops; spinlock_t l_lock; struct list_head l_blocked_list; struct list_head l_mask_waiters; enum ocfs2_lock_type l_type; unsigned long l_flags; char l_name[OCFS2_LOCK_ID_MAX_LEN]; int l_level; unsigned int l_ro_holders; unsigned int l_ex_holders; struct dlm_lockstatus l_lksb; /* used from AST/BAST funcs. */ enum ocfs2_ast_action l_action; enum ocfs2_unlock_action l_unlock_action; int l_requested; int l_blocking; wait_queue_head_t l_event; struct list_head l_debug_list;#ifdef CONFIG_OCFS2_FS_STATS unsigned long long l_lock_num_prmode; /* PR acquires */ unsigned long long l_lock_num_exmode; /* EX acquires */ unsigned int l_lock_num_prmode_failed; /* Failed PR gets */ unsigned int l_lock_num_exmode_failed; /* Failed EX gets */ unsigned long long l_lock_total_prmode; /* Tot wait for PR */ unsigned long long l_lock_total_exmode; /* Tot wait for EX */ unsigned int l_lock_max_prmode; /* Max wait for PR */ unsigned int l_lock_max_exmode; /* Max wait for EX */ unsigned int l_lock_refresh; /* Disk refreshes */#endif};struct ocfs2_dlm_debug { struct kref d_refcnt; struct dentry *d_locking_state; struct list_head d_lockres_tracking;};enum ocfs2_vol_state{ VOLUME_INIT = 0, VOLUME_MOUNTED, VOLUME_DISMOUNTED, VOLUME_DISABLED};struct ocfs2_alloc_stats{ atomic_t moves; atomic_t local_data; atomic_t bitmap_data; atomic_t bg_allocs; atomic_t bg_extends;};enum ocfs2_local_alloc_state{ OCFS2_LA_UNUSED = 0, OCFS2_LA_ENABLED, OCFS2_LA_DISABLED};enum ocfs2_mount_options{ OCFS2_MOUNT_HB_LOCAL = 1 << 0, /* Heartbeat started in local mode */ OCFS2_MOUNT_BARRIER = 1 << 1, /* Use block barriers */ OCFS2_MOUNT_NOINTR = 1 << 2, /* Don't catch signals */ OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */ OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */ OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */#ifdef OCFS2_ORACORE_WORKAROUNDS OCFS2_MOUNT_COMPAT_OCFS = 1 << 30, /* ocfs1 compatibility mode */#endif};#define OCFS2_OSB_SOFT_RO 0x0001#define OCFS2_OSB_HARD_RO 0x0002#define OCFS2_OSB_ERROR_FS 0x0004#define OCFS2_DEFAULT_ATIME_QUANTUM 60struct ocfs2_journal;struct ocfs2_super{ struct task_struct *commit_task; struct super_block *sb; struct inode *root_inode; struct inode *sys_root_inode; struct inode *system_inodes[NUM_SYSTEM_INODES]; struct ocfs2_slot_info *slot_info; u32 *slot_recovery_generations; spinlock_t node_map_lock; struct ocfs2_node_map recovery_map; u64 root_blkno; u64 system_dir_blkno; u64 bitmap_blkno; u32 bitmap_cpg; u8 *uuid; char *uuid_str; u8 *vol_label; u64 first_cluster_group_blkno; u32 fs_generation; u32 s_feature_compat; u32 s_feature_incompat; u32 s_feature_ro_compat; /* Protects s_next_generation, osb_flags and s_inode_steal_slot. * Could protect more on osb as it's very short lived. */ spinlock_t osb_lock; u32 s_next_generation; unsigned long osb_flags; s16 s_inode_steal_slot; atomic_t s_num_inodes_stolen; unsigned long s_mount_opt; unsigned int s_atime_quantum; u16 max_slots; s16 node_num; s16 slot_num; s16 preferred_slot; int s_sectsize_bits; int s_clustersize; int s_clustersize_bits; atomic_t vol_state; struct mutex recovery_lock; struct task_struct *recovery_thread_task; int disable_recovery; wait_queue_head_t checkpoint_event; atomic_t needs_checkpoint; struct ocfs2_journal *journal; unsigned long osb_commit_interval; int local_alloc_size; enum ocfs2_local_alloc_state local_alloc_state; struct buffer_head *local_alloc_bh; u64 la_last_gd; /* Next two fields are for local node slot recovery during * mount. */ int dirty; struct ocfs2_dinode *local_alloc_copy; struct ocfs2_alloc_stats alloc_stats; char dev_str[20]; /* "major,minor" of the device */ struct dlm_ctxt *dlm; struct ocfs2_lock_res osb_super_lockres; struct ocfs2_lock_res osb_rename_lockres; struct dlm_eviction_cb osb_eviction_cb; struct ocfs2_dlm_debug *osb_dlm_debug; struct dlm_protocol_version osb_locking_proto; struct dentry *osb_debug_root; wait_queue_head_t recovery_event; spinlock_t dc_task_lock; struct task_struct *dc_task; wait_queue_head_t dc_event; unsigned long dc_wake_sequence; unsigned long dc_work_sequence; /* * Any thread can add locks to the list, but the downconvert * thread is the only one allowed to remove locks. Any change * to this rule requires updating * ocfs2_downconvert_thread_do_work().
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -