Blame view

fs/ocfs2/dlmglue.h 6.74 KB
328970de0   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-or-later */
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
2
3
4
5
6
7
8
9
  /* -*- mode: c; c-basic-offset: 8; -*-
   * vim: noexpandtab sw=8 ts=8 sts=0:
   *
   * dlmglue.h
   *
   * description here
   *
   * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
10
11
12
13
14
   */
  
  
  #ifndef DLMGLUE_H
  #define DLMGLUE_H
d680efe9d   Mark Fasheh   ocfs2: Add new cl...
15
  #include "dcache.h"
15b1e36bd   Mark Fasheh   ocfs2: Structure ...
16
  #define OCFS2_LVB_VERSION 5
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
17
18
  
  struct ocfs2_meta_lvb {
4d3b83f73   Mark Fasheh   ocfs2: Free up so...
19
  	__u8         lvb_version;
24c19ef40   Mark Fasheh   ocfs2: Remove i_g...
20
  	__u8         lvb_reserved0;
15b1e36bd   Mark Fasheh   ocfs2: Structure ...
21
  	__be16       lvb_idynfeatures;
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
22
23
24
25
26
27
28
29
30
  	__be32       lvb_iclusters;
  	__be32       lvb_iuid;
  	__be32       lvb_igid;
  	__be64       lvb_iatime_packed;
  	__be64       lvb_ictime_packed;
  	__be64       lvb_imtime_packed;
  	__be64       lvb_isize;
  	__be16       lvb_imode;
  	__be16       lvb_inlink;
ca4d147e6   Herbert Poetzl   ocfs2: add ext2 a...
31
  	__be32       lvb_iattr;
f9e2d82e6   Mark Fasheh   ocfs2: Encode i_g...
32
33
  	__be32       lvb_igeneration;
  	__be32       lvb_reserved2;
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
34
  };
9e33d69f5   Jan Kara   ocfs2: Implementa...
35
36
37
38
39
40
41
42
43
44
45
46
  #define OCFS2_QINFO_LVB_VERSION 1
  
  struct ocfs2_qinfo_lvb {
  	__u8	lvb_version;
  	__u8	lvb_reserved[3];
  	__be32	lvb_bgrace;
  	__be32	lvb_igrace;
  	__be32	lvb_syncms;
  	__be32	lvb_blocks;
  	__be32	lvb_free_blk;
  	__be32	lvb_free_entry;
  };
83273932f   Srinivas Eeda   ocfs2: timer to q...
47
48
49
50
51
52
53
  #define OCFS2_ORPHAN_LVB_VERSION 1
  
  struct ocfs2_orphan_scan_lvb {
  	__u8	lvb_version;
  	__u8	lvb_reserved[3];
  	__be32	lvb_os_seqno;
  };
4882abebc   Gang He   ocfs2: add trimfs...
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  #define OCFS2_TRIMFS_LVB_VERSION 1
  
  struct ocfs2_trim_fs_lvb {
  	__u8	lvb_version;
  	__u8	lvb_success;
  	__u8	lvb_reserved[2];
  	__be32	lvb_nodenum;
  	__be64	lvb_start;
  	__be64	lvb_len;
  	__be64	lvb_minlen;
  	__be64	lvb_trimlen;
  };
  
  struct ocfs2_trim_fs_info {
  	u8	tf_valid;	/* lvb is valid, or not */
  	u8	tf_success;	/* trim is successful, or not */
  	u32	tf_nodenum;	/* osb node number */
  	u64	tf_start;	/* trim start offset in clusters */
  	u64	tf_len;		/* trim end offset in clusters */
  	u64	tf_minlen;	/* trim minimum contiguous free clusters */
  	u64	tf_trimlen;	/* trimmed length in bytes */
  };
439a36b8e   Eric Ren   ocfs2/dlmglue: pr...
76
77
78
  struct ocfs2_lock_holder {
  	struct list_head oh_list;
  	struct pid *oh_owner_pid;
133b81f28   Larry Chen   ocfs2: ocfs2_inod...
79
  	int oh_ex;
439a36b8e   Eric Ren   ocfs2/dlmglue: pr...
80
  };
e63aecb65   Mark Fasheh   ocfs2: Rename ocf...
81
  /* ocfs2_inode_lock_full() 'arg_flags' flags */
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
82
83
84
85
  /* don't wait on recovery. */
  #define OCFS2_META_LOCK_RECOVERY	(0x01)
  /* Instruct the dlm not to queue ourselves on the other node. */
  #define OCFS2_META_LOCK_NOQUEUE		(0x02)
34d024f84   Mark Fasheh   ocfs2: Remove mou...
86
  /* don't block waiting for the downconvert thread, instead return -EAGAIN */
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
87
  #define OCFS2_LOCK_NONBLOCK		(0x04)
439a36b8e   Eric Ren   ocfs2/dlmglue: pr...
88
89
  /* just get back disk inode bh if we've got cluster lock. */
  #define OCFS2_META_LOCK_GETBH		(0x08)
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
90

cb25797d4   Jan Kara   ocfs2: Add lockde...
91
92
93
94
95
96
  /* Locking subclasses of inode cluster lock */
  enum {
  	OI_LS_NORMAL = 0,
  	OI_LS_PARENT,
  	OI_LS_RENAME1,
  	OI_LS_RENAME2,
07eaac943   Tao Ma   ocfs2: Fix lockde...
97
  	OI_LS_REFLINK_TARGET,
cb25797d4   Jan Kara   ocfs2: Add lockde...
98
  };
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
99
  int ocfs2_dlm_init(struct ocfs2_super *osb);
286eaa95c   Joel Becker   ocfs2: Break out ...
100
  void ocfs2_dlm_shutdown(struct ocfs2_super *osb, int hangup_pending);
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
101
102
103
  void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res);
  void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
  			       enum ocfs2_lock_type type,
24c19ef40   Mark Fasheh   ocfs2: Remove i_g...
104
  			       unsigned int generation,
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
105
  			       struct inode *inode);
d680efe9d   Mark Fasheh   ocfs2: Add new cl...
106
107
  void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
  				u64 parent, struct inode *inode);
cf8e06f1a   Mark Fasheh   [PATCH 1/2] ocfs2...
108
109
110
  struct ocfs2_file_private;
  void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres,
  			      struct ocfs2_file_private *fp);
9e33d69f5   Jan Kara   ocfs2: Implementa...
111
112
113
  struct ocfs2_mem_dqinfo;
  void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres,
                                 struct ocfs2_mem_dqinfo *info);
8dec98edf   Tao Ma   ocfs2: Add new re...
114
115
116
  void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres,
  				  struct ocfs2_super *osb, u64 ref_blkno,
  				  unsigned int generation);
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
117
118
119
  void ocfs2_lock_res_free(struct ocfs2_lock_res *res);
  int ocfs2_create_new_inode_locks(struct inode *inode);
  int ocfs2_drop_inode_locks(struct inode *inode);
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
120
  int ocfs2_rw_lock(struct inode *inode, int write);
06e7f13d1   Gang He   ocfs2: add ocfs2_...
121
  int ocfs2_try_rw_lock(struct inode *inode, int write);
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
122
  void ocfs2_rw_unlock(struct inode *inode, int write);
500086300   Tiger Yang   ocfs2: Remove del...
123
124
125
  int ocfs2_open_lock(struct inode *inode);
  int ocfs2_try_open_lock(struct inode *inode, int write);
  void ocfs2_open_unlock(struct inode *inode);
e63aecb65   Mark Fasheh   ocfs2: Rename ocf...
126
  int ocfs2_inode_lock_atime(struct inode *inode,
7f1a37e31   Tiger Yang   ocfs2: core atime...
127
  			  struct vfsmount *vfsmnt,
c4c2416ab   Gang He   ocfs2: nowait aio...
128
  			  int *level, int wait);
cb25797d4   Jan Kara   ocfs2: Add lockde...
129
  int ocfs2_inode_lock_full_nested(struct inode *inode,
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
130
131
  			 struct buffer_head **ret_bh,
  			 int ex,
cb25797d4   Jan Kara   ocfs2: Add lockde...
132
133
  			 int arg_flags,
  			 int subclass);
e63aecb65   Mark Fasheh   ocfs2: Rename ocf...
134
  int ocfs2_inode_lock_with_page(struct inode *inode,
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
135
136
137
  			      struct buffer_head **ret_bh,
  			      int ex,
  			      struct page *page);
cb25797d4   Jan Kara   ocfs2: Add lockde...
138
139
140
141
142
  /* Variants without special locking class or flags */
  #define ocfs2_inode_lock_full(i, r, e, f)\
  		ocfs2_inode_lock_full_nested(i, r, e, f, OI_LS_NORMAL)
  #define ocfs2_inode_lock_nested(i, b, e, s)\
  		ocfs2_inode_lock_full_nested(i, b, e, 0, s)
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
143
144
  /* 99% of the time we don't want to supply any additional flags --
   * those are for very specific cases only. */
cb25797d4   Jan Kara   ocfs2: Add lockde...
145
  #define ocfs2_inode_lock(i, b, e) ocfs2_inode_lock_full_nested(i, b, e, 0, OI_LS_NORMAL)
06e7f13d1   Gang He   ocfs2: add ocfs2_...
146
147
148
  #define ocfs2_try_inode_lock(i, b, e)\
  		ocfs2_inode_lock_full_nested(i, b, e, OCFS2_META_LOCK_NOQUEUE,\
  		OI_LS_NORMAL)
e63aecb65   Mark Fasheh   ocfs2: Rename ocf...
149
  void ocfs2_inode_unlock(struct inode *inode,
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
150
151
152
153
154
  		       int ex);
  int ocfs2_super_lock(struct ocfs2_super *osb,
  		     int ex);
  void ocfs2_super_unlock(struct ocfs2_super *osb,
  			int ex);
df152c241   Sunil Mushran   ocfs2: Disable or...
155
156
  int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno);
  void ocfs2_orphan_scan_unlock(struct ocfs2_super *osb, u32 seqno);
83273932f   Srinivas Eeda   ocfs2: timer to q...
157

ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
158
159
  int ocfs2_rename_lock(struct ocfs2_super *osb);
  void ocfs2_rename_unlock(struct ocfs2_super *osb);
6ca497a83   wengang wang   ocfs2: fix rare s...
160
161
  int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex);
  void ocfs2_nfs_sync_unlock(struct ocfs2_super *osb, int ex);
4882abebc   Gang He   ocfs2: add trimfs...
162
163
164
165
166
167
  void ocfs2_trim_fs_lock_res_init(struct ocfs2_super *osb);
  void ocfs2_trim_fs_lock_res_uninit(struct ocfs2_super *osb);
  int ocfs2_trim_fs_lock(struct ocfs2_super *osb,
  		       struct ocfs2_trim_fs_info *info, int trylock);
  void ocfs2_trim_fs_unlock(struct ocfs2_super *osb,
  			  struct ocfs2_trim_fs_info *info);
d680efe9d   Mark Fasheh   ocfs2: Add new cl...
168
169
  int ocfs2_dentry_lock(struct dentry *dentry, int ex);
  void ocfs2_dentry_unlock(struct dentry *dentry, int ex);
cf8e06f1a   Mark Fasheh   [PATCH 1/2] ocfs2...
170
171
  int ocfs2_file_lock(struct file *file, int ex, int trylock);
  void ocfs2_file_unlock(struct file *file);
9e33d69f5   Jan Kara   ocfs2: Implementa...
172
173
  int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex);
  void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex);
8dec98edf   Tao Ma   ocfs2: Add new re...
174
175
176
  struct ocfs2_refcount_tree;
  int ocfs2_refcount_lock(struct ocfs2_refcount_tree *ref_tree, int ex);
  void ocfs2_refcount_unlock(struct ocfs2_refcount_tree *ref_tree, int ex);
9e33d69f5   Jan Kara   ocfs2: Implementa...
177

d680efe9d   Mark Fasheh   ocfs2: Add new cl...
178

84d86f83f   Jan Kara   ocfs2: avoid bloc...
179
180
  void ocfs2_mark_lockres_freeing(struct ocfs2_super *osb,
  				struct ocfs2_lock_res *lockres);
d680efe9d   Mark Fasheh   ocfs2: Add new cl...
181
182
  void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
  			       struct ocfs2_lock_res *lockres);
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
183

34d024f84   Mark Fasheh   ocfs2: Remove mou...
184
  /* for the downconvert thread */
34d024f84   Mark Fasheh   ocfs2: Remove mou...
185
  void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb);
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
186
187
188
  
  struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void);
  void ocfs2_put_dlm_debug(struct ocfs2_dlm_debug *dlm_debug);
63e0c48ae   Joel Becker   ocfs2: Clean up s...
189
190
  /* To set the locking protocol on module initialization */
  void ocfs2_set_locking_protocol(void);
439a36b8e   Eric Ren   ocfs2/dlmglue: pr...
191
192
193
194
195
196
197
198
199
200
  
  /* The _tracker pair is used to avoid cluster recursive locking */
  int ocfs2_inode_lock_tracker(struct inode *inode,
  			     struct buffer_head **ret_bh,
  			     int ex,
  			     struct ocfs2_lock_holder *oh);
  void ocfs2_inode_unlock_tracker(struct inode *inode,
  				int ex,
  				struct ocfs2_lock_holder *oh,
  				int had_lock);
ccd979bdb   Mark Fasheh   [PATCH] OCFS2: Th...
201
  #endif	/* DLMGLUE_H */