/* For struct ocfs2_blockcheck_stats */ #include"blockcheck.h"
#include"reservations.h"
#include"filecheck.h"
/* Caching of metadata buffers */
/* 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_CACHE_INFO_MAX_ARRAY 2
/* Flags for ocfs2_caching_info */
enum ocfs2_caching_info_flags { /* Indicates that the metadata cache is using the inline array */
OCFS2_CACHE_FL_INLINE = 1<<1,
};
struct ocfs2_caching_operations; struct ocfs2_caching_info { /* * The parent structure provides the locks, but because the * parent structure can differ, it provides locking operations * to struct ocfs2_caching_info.
*/ conststruct ocfs2_caching_operations *ci_ops;
/* next two are protected by trans_inc_lock */ /* which transaction were we created on? Zero if none. */ unsignedlong ci_created_trans; /* last transaction we were a part of. */ unsignedlong ci_last_trans;
/* Cache structures */ unsignedint ci_flags; unsignedint ci_num_cached; union {
sector_t ci_array[OCFS2_CACHE_INFO_MAX_ARRAY]; struct rb_root ci_tree;
} ci_cache;
}; /* * Need this prototype here instead of in uptodate.h because journal.h * uses it.
*/ struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci);
/* this limits us to 256 nodes
* if we need more, we can do a kmalloc for the map */ #define OCFS2_NODE_MAP_MAX_NODES 256 struct ocfs2_node_map {
u16 num_nodes; unsignedlong map[BITS_TO_LONGS(OCFS2_NODE_MAP_MAX_NODES)];
};
/* 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) /* we have 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 */ #define OCFS2_LOCK_PENDING (0x00000400) /* This lockres is pending a call to dlm_lock. Only
exists with BUSY set. */ #define OCFS2_LOCK_UPCONVERT_FINISHING (0x00000800) /* blocks the dc thread * from downconverting * before the upconvert
* has completed */
#define OCFS2_LOCK_NONBLOCK_FINISHED (0x00001000) /* NONBLOCK cluster * lock has already * returned, do not block * dc thread from
* downconverting */
/* Data packed - type enum ocfs2_lock_type */ unsignedchar l_type;
/* used from AST/BAST funcs. */ /* Data packed - enum type ocfs2_ast_action */ unsignedchar l_action; /* Data packed - enum type ocfs2_unlock_action */ unsignedchar l_unlock_action; unsignedint l_pending_gen;
spinlock_t l_lock;
struct ocfs2_dlm_lksb l_lksb;
wait_queue_head_t l_event;
struct list_head l_debug_list;
#ifdef CONFIG_OCFS2_FS_STATS struct ocfs2_lock_stats l_lock_prmode; /* PR mode stats */
u32 l_lock_refresh; /* Disk refreshes */
u64 l_lock_wait; /* First lock wait time */ struct ocfs2_lock_stats l_lock_exmode; /* EX mode stats */ #endif #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map l_lockdep_map; #endif
};
enum ocfs2_local_alloc_state
{
OCFS2_LA_UNUSED = 0, /* Local alloc will never be used for
* this mountpoint. */
OCFS2_LA_ENABLED, /* Local alloc is in use. */
OCFS2_LA_THROTTLED, /* Local alloc is in use, but number
* of bits has been reduced. */
OCFS2_LA_DISABLED /* Local alloc has temporarily been
* disabled. */
};
enum ocfs2_mount_options
{
OCFS2_MOUNT_HB_LOCAL = 1 << 0, /* Local heartbeat */
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 */
OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */
OCFS2_MOUNT_INODE64 = 1 << 7, /* Allow inode numbers > 2^32 */
OCFS2_MOUNT_POSIX_ACL = 1 << 8, /* Force POSIX access control lists */
OCFS2_MOUNT_NO_POSIX_ACL = 1 << 9, /* Disable POSIX access
control lists */
OCFS2_MOUNT_USRQUOTA = 1 << 10, /* We support user quotas */
OCFS2_MOUNT_GRPQUOTA = 1 << 11, /* We support group quotas */
OCFS2_MOUNT_COHERENCY_BUFFERED = 1 << 12, /* Allow concurrent O_DIRECT
writes */
OCFS2_MOUNT_HB_NONE = 1 << 13, /* No heartbeat */
OCFS2_MOUNT_HB_GLOBAL = 1 << 14, /* Global heartbeat */
OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT = 1 << 15, /* Journal Async Commit */
OCFS2_MOUNT_ERRORS_CONT = 1 << 16, /* Return EIO to the calling process on error */
OCFS2_MOUNT_ERRORS_ROFS = 1 << 17, /* Change filesystem to read-only on error */
};
enum ocfs2_journal_trigger_type {
OCFS2_JTR_DI,
OCFS2_JTR_EB,
OCFS2_JTR_RB,
OCFS2_JTR_GD,
OCFS2_JTR_DB,
OCFS2_JTR_XB,
OCFS2_JTR_DQ,
OCFS2_JTR_DR,
OCFS2_JTR_DL,
OCFS2_JTR_NONE /* This must be the last entry */
};
enum ocfs2_recovery_state {
OCFS2_REC_ENABLED = 0,
OCFS2_REC_QUOTA_WANT_DISABLE, /* * Must be OCFS2_REC_QUOTA_WANT_DISABLE + 1 for * ocfs2_recovery_disable_quota() to work.
*/
OCFS2_REC_QUOTA_DISABLED,
OCFS2_REC_WANT_DISABLE, /* * Must be OCFS2_REC_WANT_DISABLE + 1 for ocfs2_recovery_exit() to work
*/
OCFS2_REC_DISABLED,
};
/* 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; unsignedlong osb_flags;
u16 s_inode_steal_slot;
u16 s_meta_steal_slot;
atomic_t s_num_inodes_stolen;
atomic_t s_num_meta_stolen;
unsignedint max_slots; unsignedint node_num; int slot_num; int preferred_slot; int s_sectsize_bits; int s_clustersize; int s_clustersize_bits; unsignedint s_xattr_inline_size;
/* Journal triggers for checksum */ struct ocfs2_triggers s_journal_triggers[OCFS2_JOURNAL_TRIGGER_COUNT];
struct delayed_work la_enable_wq;
/* * Must hold local alloc i_rwsem and osb->osb_lock to change * local_alloc_bits. Reads can be done under either lock.
*/ unsignedint local_alloc_bits; unsignedint local_alloc_default_bits; /* osb_clusters_at_boot can become stale! Do not trust it to
* be up to date. */ unsignedint osb_clusters_at_boot;
enum ocfs2_local_alloc_state local_alloc_state; /* protected
* by osb_lock */
/* * 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().
*/ struct list_head blocked_lock_list; unsignedlong blocked_lock_count;
/* List of dquot structures to drop last reference to */ struct llist_head dquot_drop_list; struct work_struct dquot_drop_work;
wait_queue_head_t osb_mount_event;
/* Truncate log info */ struct inode *osb_tl_inode; struct buffer_head *osb_tl_bh; struct delayed_work osb_truncate_log_wq;
atomic_t osb_tl_disable; /* * How many clusters in our truncate log. * It must be protected by osb_tl_inode->i_rwsem.
*/ unsignedint truncated_clusters;
/* used to protect metaecc calculation check of xattr. */
spinlock_t osb_xattr_lock;
unsignedint osb_dx_mask;
u32 osb_dx_seed[4];
/* the group we used to allocate inodes. */
u64 osb_inode_alloc_group;
/* rb tree root for refcount lock. */ struct rb_root osb_rf_lock_tree; struct ocfs2_refcount_tree *osb_ref_tree_lru;
struct mutex system_file_mutex;
/* * OCFS2 needs to schedule several different types of work which * require cluster locking, disk I/O, recovery waits, etc. Since these * types of work tend to be heavy we avoid using the kernel events * workqueue and schedule on our own.
*/ struct workqueue_struct *ocfs2_wq;
/* sysfs directory per partition */ struct kset *osb_dev_kset;
/* file check related stuff */ struct ocfs2_filecheck_sysfs_entry osb_fc_ent;
};
staticinlineint ocfs2_writes_unwritten_extents(struct ocfs2_super *osb)
{ /* * Support for sparse files is a pre-requisite
*/ if (!ocfs2_sparse_alloc(osb)) return 0;
if (osb->s_feature_ro_compat & OCFS2_FEATURE_RO_COMPAT_UNWRITTEN) return 1; return 0;
}
/* set / clear functions because cluster events can make these happen * in parallel so we want the transitions to be atomic. this also * means that any future flags osb_flags must be protected by spinlock
* too! */ staticinlinevoid ocfs2_set_osb_flag(struct ocfs2_super *osb, unsignedlong flag)
{
spin_lock(&osb->osb_lock);
osb->osb_flags |= flag;
spin_unlock(&osb->osb_lock);
}
/* * Find the 1st page index which covers the given clusters.
*/ staticinline pgoff_t ocfs2_align_clusters_to_page_index(struct super_block *sb,
u32 clusters)
{ unsignedint cbits = OCFS2_SB(sb)->s_clustersize_bits;
pgoff_t index = clusters;
if (PAGE_SHIFT > cbits) {
index = (pgoff_t)clusters >> (PAGE_SHIFT - cbits);
} elseif (PAGE_SHIFT < cbits) {
index = (pgoff_t)clusters << (cbits - PAGE_SHIFT);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.