0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef DLMGLUE_H
0012 #define DLMGLUE_H
0013
0014 #include "dcache.h"
0015
0016 #define OCFS2_LVB_VERSION 5
0017
0018 struct ocfs2_meta_lvb {
0019 __u8 lvb_version;
0020 __u8 lvb_reserved0;
0021 __be16 lvb_idynfeatures;
0022 __be32 lvb_iclusters;
0023 __be32 lvb_iuid;
0024 __be32 lvb_igid;
0025 __be64 lvb_iatime_packed;
0026 __be64 lvb_ictime_packed;
0027 __be64 lvb_imtime_packed;
0028 __be64 lvb_isize;
0029 __be16 lvb_imode;
0030 __be16 lvb_inlink;
0031 __be32 lvb_iattr;
0032 __be32 lvb_igeneration;
0033 __be32 lvb_reserved2;
0034 };
0035
0036 #define OCFS2_QINFO_LVB_VERSION 1
0037
0038 struct ocfs2_qinfo_lvb {
0039 __u8 lvb_version;
0040 __u8 lvb_reserved[3];
0041 __be32 lvb_bgrace;
0042 __be32 lvb_igrace;
0043 __be32 lvb_syncms;
0044 __be32 lvb_blocks;
0045 __be32 lvb_free_blk;
0046 __be32 lvb_free_entry;
0047 };
0048
0049 #define OCFS2_ORPHAN_LVB_VERSION 1
0050
0051 struct ocfs2_orphan_scan_lvb {
0052 __u8 lvb_version;
0053 __u8 lvb_reserved[3];
0054 __be32 lvb_os_seqno;
0055 };
0056
0057 #define OCFS2_TRIMFS_LVB_VERSION 1
0058
0059 struct ocfs2_trim_fs_lvb {
0060 __u8 lvb_version;
0061 __u8 lvb_success;
0062 __u8 lvb_reserved[2];
0063 __be32 lvb_nodenum;
0064 __be64 lvb_start;
0065 __be64 lvb_len;
0066 __be64 lvb_minlen;
0067 __be64 lvb_trimlen;
0068 };
0069
0070 struct ocfs2_trim_fs_info {
0071 u8 tf_valid;
0072 u8 tf_success;
0073 u32 tf_nodenum;
0074 u64 tf_start;
0075 u64 tf_len;
0076 u64 tf_minlen;
0077 u64 tf_trimlen;
0078 };
0079
0080 struct ocfs2_lock_holder {
0081 struct list_head oh_list;
0082 struct pid *oh_owner_pid;
0083 int oh_ex;
0084 };
0085
0086
0087
0088 #define OCFS2_META_LOCK_RECOVERY (0x01)
0089
0090 #define OCFS2_META_LOCK_NOQUEUE (0x02)
0091
0092 #define OCFS2_LOCK_NONBLOCK (0x04)
0093
0094 #define OCFS2_META_LOCK_GETBH (0x08)
0095
0096
0097 enum {
0098 OI_LS_NORMAL = 0,
0099 OI_LS_PARENT,
0100 OI_LS_RENAME1,
0101 OI_LS_RENAME2,
0102 OI_LS_REFLINK_TARGET,
0103 };
0104
0105 int ocfs2_dlm_init(struct ocfs2_super *osb);
0106 void ocfs2_dlm_shutdown(struct ocfs2_super *osb, int hangup_pending);
0107 void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res);
0108 void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
0109 enum ocfs2_lock_type type,
0110 unsigned int generation,
0111 struct inode *inode);
0112 void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
0113 u64 parent, struct inode *inode);
0114 struct ocfs2_file_private;
0115 void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres,
0116 struct ocfs2_file_private *fp);
0117 struct ocfs2_mem_dqinfo;
0118 void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres,
0119 struct ocfs2_mem_dqinfo *info);
0120 void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres,
0121 struct ocfs2_super *osb, u64 ref_blkno,
0122 unsigned int generation);
0123 void ocfs2_lock_res_free(struct ocfs2_lock_res *res);
0124 int ocfs2_create_new_inode_locks(struct inode *inode);
0125 int ocfs2_drop_inode_locks(struct inode *inode);
0126 int ocfs2_rw_lock(struct inode *inode, int write);
0127 int ocfs2_try_rw_lock(struct inode *inode, int write);
0128 void ocfs2_rw_unlock(struct inode *inode, int write);
0129 int ocfs2_open_lock(struct inode *inode);
0130 int ocfs2_try_open_lock(struct inode *inode, int write);
0131 void ocfs2_open_unlock(struct inode *inode);
0132 int ocfs2_inode_lock_atime(struct inode *inode,
0133 struct vfsmount *vfsmnt,
0134 int *level, int wait);
0135 int ocfs2_inode_lock_full_nested(struct inode *inode,
0136 struct buffer_head **ret_bh,
0137 int ex,
0138 int arg_flags,
0139 int subclass);
0140 int ocfs2_inode_lock_with_page(struct inode *inode,
0141 struct buffer_head **ret_bh,
0142 int ex,
0143 struct page *page);
0144
0145 #define ocfs2_inode_lock_full(i, r, e, f)\
0146 ocfs2_inode_lock_full_nested(i, r, e, f, OI_LS_NORMAL)
0147 #define ocfs2_inode_lock_nested(i, b, e, s)\
0148 ocfs2_inode_lock_full_nested(i, b, e, 0, s)
0149
0150
0151 #define ocfs2_inode_lock(i, b, e) ocfs2_inode_lock_full_nested(i, b, e, 0, OI_LS_NORMAL)
0152 #define ocfs2_try_inode_lock(i, b, e)\
0153 ocfs2_inode_lock_full_nested(i, b, e, OCFS2_META_LOCK_NOQUEUE,\
0154 OI_LS_NORMAL)
0155 void ocfs2_inode_unlock(struct inode *inode,
0156 int ex);
0157 int ocfs2_super_lock(struct ocfs2_super *osb,
0158 int ex);
0159 void ocfs2_super_unlock(struct ocfs2_super *osb,
0160 int ex);
0161 int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno);
0162 void ocfs2_orphan_scan_unlock(struct ocfs2_super *osb, u32 seqno);
0163
0164 int ocfs2_rename_lock(struct ocfs2_super *osb);
0165 void ocfs2_rename_unlock(struct ocfs2_super *osb);
0166 int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex);
0167 void ocfs2_nfs_sync_unlock(struct ocfs2_super *osb, int ex);
0168 void ocfs2_trim_fs_lock_res_init(struct ocfs2_super *osb);
0169 void ocfs2_trim_fs_lock_res_uninit(struct ocfs2_super *osb);
0170 int ocfs2_trim_fs_lock(struct ocfs2_super *osb,
0171 struct ocfs2_trim_fs_info *info, int trylock);
0172 void ocfs2_trim_fs_unlock(struct ocfs2_super *osb,
0173 struct ocfs2_trim_fs_info *info);
0174 int ocfs2_dentry_lock(struct dentry *dentry, int ex);
0175 void ocfs2_dentry_unlock(struct dentry *dentry, int ex);
0176 int ocfs2_file_lock(struct file *file, int ex, int trylock);
0177 void ocfs2_file_unlock(struct file *file);
0178 int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex);
0179 void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex);
0180 struct ocfs2_refcount_tree;
0181 int ocfs2_refcount_lock(struct ocfs2_refcount_tree *ref_tree, int ex);
0182 void ocfs2_refcount_unlock(struct ocfs2_refcount_tree *ref_tree, int ex);
0183
0184
0185 void ocfs2_mark_lockres_freeing(struct ocfs2_super *osb,
0186 struct ocfs2_lock_res *lockres);
0187 void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
0188 struct ocfs2_lock_res *lockres);
0189
0190
0191 void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb);
0192
0193 struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void);
0194 void ocfs2_put_dlm_debug(struct ocfs2_dlm_debug *dlm_debug);
0195
0196
0197 void ocfs2_set_locking_protocol(void);
0198
0199
0200 int ocfs2_inode_lock_tracker(struct inode *inode,
0201 struct buffer_head **ret_bh,
0202 int ex,
0203 struct ocfs2_lock_holder *oh);
0204 void ocfs2_inode_unlock_tracker(struct inode *inode,
0205 int ex,
0206 struct ocfs2_lock_holder *oh,
0207 int had_lock);
0208
0209 #endif