Whamcloud - gitweb
283546d8eadecbc67104672aa7caf2ba4d73a23f
[fs/lustre-release.git] / lustre / include / lustre_dlm_flags.h
1 /*  -*- buffer-read-only: t -*- vi: set ro:
2  *
3  * DO NOT EDIT THIS FILE   (lustre_dlm_flags.h)
4  *
5  * It has been AutoGen-ed
6  * From the definitions    lustre_dlm_flags.def
7  * and the template file   lustre_dlm_flags.tpl
8  *
9  * lustre is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the
11  * Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * lustre is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17  * See the GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 /**
23  * \file lustre_dlm_flags.h
24  * The flags and collections of flags (masks) for \see struct ldlm_lock.
25  * This file is derived from flag definitions in lustre_dlm_flags.def.
26  * The format is defined in the lustre_dlm_flags.tpl template file.
27  *
28  * \addtogroup LDLM Lustre Distributed Lock Manager
29  * @{
30  *
31  * \name flags
32  * The flags and collections of flags (masks) for \see struct ldlm_lock.
33  * @{
34  */
35 #ifndef LDLM_ALL_FLAGS_MASK
36
37 /** l_flags bits marked as "all_flags" bits */
38 #define LDLM_FL_ALL_FLAGS_MASK          0x00FFFFFFC08F932FULL
39
40 /** l_flags bits marked as "ast" bits */
41 #define LDLM_FL_AST_MASK                0x0000000080008000ULL
42
43 /** l_flags bits marked as "blocked" bits */
44 #define LDLM_FL_BLOCKED_MASK            0x000000000000000EULL
45
46 /** l_flags bits marked as "gone" bits */
47 #define LDLM_FL_GONE_MASK               0x0006004000000000ULL
48
49 /** l_flags bits marked as "inherit" bits */
50 #define LDLM_FL_INHERIT_MASK            0x0000000000800000ULL
51
52 /** l_flags bits marked as "off_wire" bits */
53 #define LDLM_FL_OFF_WIRE_MASK           0x00FFFFFF00000000ULL
54
55 /** l_flags bits marked as "on_wire" bits */
56 #define LDLM_FL_ON_WIRE_MASK            0x00000000C08F932FULL
57
58 /** extent, mode, or resource changed */
59 #define LDLM_FL_LOCK_CHANGED            0x0000000000000001ULL // bit   0
60 #define ldlm_is_lock_changed(_l)        LDLM_TEST_FLAG(( _l), 1ULL <<  0)
61 #define ldlm_set_lock_changed(_l)       LDLM_SET_FLAG((  _l), 1ULL <<  0)
62 #define ldlm_clear_lock_changed(_l)     LDLM_CLEAR_FLAG((_l), 1ULL <<  0)
63
64 /**
65  * Server placed lock on granted list, or a recovering client wants the
66  * lock added to the granted list, no questions asked. */
67 #define LDLM_FL_BLOCK_GRANTED           0x0000000000000002ULL // bit   1
68 #define ldlm_is_block_granted(_l)       LDLM_TEST_FLAG(( _l), 1ULL <<  1)
69 #define ldlm_set_block_granted(_l)      LDLM_SET_FLAG((  _l), 1ULL <<  1)
70 #define ldlm_clear_block_granted(_l)    LDLM_CLEAR_FLAG((_l), 1ULL <<  1)
71
72 /**
73  * Server placed lock on conv list, or a recovering client wants the lock
74  * added to the conv list, no questions asked. */
75 #define LDLM_FL_BLOCK_CONV              0x0000000000000004ULL // bit   2
76 #define ldlm_is_block_conv(_l)          LDLM_TEST_FLAG(( _l), 1ULL <<  2)
77 #define ldlm_set_block_conv(_l)         LDLM_SET_FLAG((  _l), 1ULL <<  2)
78 #define ldlm_clear_block_conv(_l)       LDLM_CLEAR_FLAG((_l), 1ULL <<  2)
79
80 /**
81  * Server placed lock on wait list, or a recovering client wants the lock
82  * added to the wait list, no questions asked. */
83 #define LDLM_FL_BLOCK_WAIT              0x0000000000000008ULL // bit   3
84 #define ldlm_is_block_wait(_l)          LDLM_TEST_FLAG(( _l), 1ULL <<  3)
85 #define ldlm_set_block_wait(_l)         LDLM_SET_FLAG((  _l), 1ULL <<  3)
86 #define ldlm_clear_block_wait(_l)       LDLM_CLEAR_FLAG((_l), 1ULL <<  3)
87
88 /** blocking or cancel packet was queued for sending. */
89 #define LDLM_FL_AST_SENT                0x0000000000000020ULL // bit   5
90 #define ldlm_is_ast_sent(_l)            LDLM_TEST_FLAG(( _l), 1ULL <<  5)
91 #define ldlm_set_ast_sent(_l)           LDLM_SET_FLAG((  _l), 1ULL <<  5)
92 #define ldlm_clear_ast_sent(_l)         LDLM_CLEAR_FLAG((_l), 1ULL <<  5)
93
94 /**
95  * Lock is being replayed.  This could probably be implied by the fact that
96  * one of BLOCK_{GRANTED,CONV,WAIT} is set, but that is pretty dangerous. */
97 #define LDLM_FL_REPLAY                  0x0000000000000100ULL // bit   8
98 #define ldlm_is_replay(_l)              LDLM_TEST_FLAG(( _l), 1ULL <<  8)
99 #define ldlm_set_replay(_l)             LDLM_SET_FLAG((  _l), 1ULL <<  8)
100 #define ldlm_clear_replay(_l)           LDLM_CLEAR_FLAG((_l), 1ULL <<  8)
101
102 /** Don't grant lock, just do intent. */
103 #define LDLM_FL_INTENT_ONLY             0x0000000000000200ULL // bit   9
104 #define ldlm_is_intent_only(_l)         LDLM_TEST_FLAG(( _l), 1ULL <<  9)
105 #define ldlm_set_intent_only(_l)        LDLM_SET_FLAG((  _l), 1ULL <<  9)
106 #define ldlm_clear_intent_only(_l)      LDLM_CLEAR_FLAG((_l), 1ULL <<  9)
107
108 /** lock request has intent */
109 #define LDLM_FL_HAS_INTENT              0x0000000000001000ULL // bit  12
110 #define ldlm_is_has_intent(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 12)
111 #define ldlm_set_has_intent(_l)         LDLM_SET_FLAG((  _l), 1ULL << 12)
112 #define ldlm_clear_has_intent(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 12)
113
114 /** flock deadlock detected */
115 #define LDLM_FL_FLOCK_DEADLOCK          0x0000000000008000ULL // bit  15
116 #define ldlm_is_flock_deadlock(_l)      LDLM_TEST_FLAG(( _l), 1ULL << 15)
117 #define ldlm_set_flock_deadlock(_l)     LDLM_SET_FLAG((  _l), 1ULL << 15)
118 #define ldlm_clear_flock_deadlock(_l)   LDLM_CLEAR_FLAG((_l), 1ULL << 15)
119
120 /** discard (no writeback) on cancel */
121 #define LDLM_FL_DISCARD_DATA            0x0000000000010000ULL // bit  16
122 #define ldlm_is_discard_data(_l)        LDLM_TEST_FLAG(( _l), 1ULL << 16)
123 #define ldlm_set_discard_data(_l)       LDLM_SET_FLAG((  _l), 1ULL << 16)
124 #define ldlm_clear_discard_data(_l)     LDLM_CLEAR_FLAG((_l), 1ULL << 16)
125
126 /** Blocked by group lock - wait indefinitely */
127 #define LDLM_FL_NO_TIMEOUT              0x0000000000020000ULL // bit  17
128 #define ldlm_is_no_timeout(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 17)
129 #define ldlm_set_no_timeout(_l)         LDLM_SET_FLAG((  _l), 1ULL << 17)
130 #define ldlm_clear_no_timeout(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 17)
131
132 /**
133  * Server told not to wait if blocked. For AGL, OST will not send glimpse
134  * callback. */
135 #define LDLM_FL_BLOCK_NOWAIT            0x0000000000040000ULL // bit  18
136 #define ldlm_is_block_nowait(_l)        LDLM_TEST_FLAG(( _l), 1ULL << 18)
137 #define ldlm_set_block_nowait(_l)       LDLM_SET_FLAG((  _l), 1ULL << 18)
138 #define ldlm_clear_block_nowait(_l)     LDLM_CLEAR_FLAG((_l), 1ULL << 18)
139
140 /** return blocking lock */
141 #define LDLM_FL_TEST_LOCK               0x0000000000080000ULL // bit  19
142 #define ldlm_is_test_lock(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 19)
143 #define ldlm_set_test_lock(_l)          LDLM_SET_FLAG((  _l), 1ULL << 19)
144 #define ldlm_clear_test_lock(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 19)
145
146 /**
147  * Immediatelly cancel such locks when they block some other locks. Send
148  * cancel notification to original lock holder, but expect no reply. This
149  * is for clients (like liblustre) that cannot be expected to reliably
150  * response to blocking AST. */
151 #define LDLM_FL_CANCEL_ON_BLOCK         0x0000000000800000ULL // bit  23
152 #define ldlm_is_cancel_on_block(_l)     LDLM_TEST_FLAG(( _l), 1ULL << 23)
153 #define ldlm_set_cancel_on_block(_l)    LDLM_SET_FLAG((  _l), 1ULL << 23)
154 #define ldlm_clear_cancel_on_block(_l)  LDLM_CLEAR_FLAG((_l), 1ULL << 23)
155
156 /**
157  * measure lock contention and return -EUSERS if locking contention is high */
158 #define LDLM_FL_DENY_ON_CONTENTION        0x0000000040000000ULL // bit  30
159 #define ldlm_is_deny_on_contention(_l)    LDLM_TEST_FLAG(( _l), 1ULL << 30)
160 #define ldlm_set_deny_on_contention(_l)   LDLM_SET_FLAG((  _l), 1ULL << 30)
161 #define ldlm_clear_deny_on_contention(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 30)
162
163 /**
164  * These are flags that are mapped into the flags and ASTs of blocking
165  * locks Add FL_DISCARD to blocking ASTs */
166 #define LDLM_FL_AST_DISCARD_DATA        0x0000000080000000ULL // bit  31
167 #define ldlm_is_ast_discard_data(_l)    LDLM_TEST_FLAG(( _l), 1ULL << 31)
168 #define ldlm_set_ast_discard_data(_l)   LDLM_SET_FLAG((  _l), 1ULL << 31)
169 #define ldlm_clear_ast_discard_data(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 31)
170
171 /**
172  * Used for marking lock as a target for -EINTR while cp_ast sleep emulation
173  * + race with upcoming bl_ast. */
174 #define LDLM_FL_FAIL_LOC                0x0000000100000000ULL // bit  32
175 #define ldlm_is_fail_loc(_l)            LDLM_TEST_FLAG(( _l), 1ULL << 32)
176 #define ldlm_set_fail_loc(_l)           LDLM_SET_FLAG((  _l), 1ULL << 32)
177 #define ldlm_clear_fail_loc(_l)         LDLM_CLEAR_FLAG((_l), 1ULL << 32)
178
179 /**
180  * Used while processing the unused list to know that we have already
181  * handled this lock and decided to skip it. */
182 #define LDLM_FL_SKIPPED                 0x0000000200000000ULL // bit  33
183 #define ldlm_is_skipped(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 33)
184 #define ldlm_set_skipped(_l)            LDLM_SET_FLAG((  _l), 1ULL << 33)
185 #define ldlm_clear_skipped(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 33)
186
187 /** this lock is being destroyed */
188 #define LDLM_FL_CBPENDING               0x0000000400000000ULL // bit  34
189 #define ldlm_is_cbpending(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 34)
190 #define ldlm_set_cbpending(_l)          LDLM_SET_FLAG((  _l), 1ULL << 34)
191 #define ldlm_clear_cbpending(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 34)
192
193 /** not a real flag, not saved in lock */
194 #define LDLM_FL_WAIT_NOREPROC           0x0000000800000000ULL // bit  35
195 #define ldlm_is_wait_noreproc(_l)       LDLM_TEST_FLAG(( _l), 1ULL << 35)
196 #define ldlm_set_wait_noreproc(_l)      LDLM_SET_FLAG((  _l), 1ULL << 35)
197 #define ldlm_clear_wait_noreproc(_l)    LDLM_CLEAR_FLAG((_l), 1ULL << 35)
198
199 /** cancellation callback already run */
200 #define LDLM_FL_CANCEL                  0x0000001000000000ULL // bit  36
201 #define ldlm_is_cancel(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 36)
202 #define ldlm_set_cancel(_l)             LDLM_SET_FLAG((  _l), 1ULL << 36)
203 #define ldlm_clear_cancel(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 36)
204
205 /** whatever it might mean -- never transmitted? */
206 #define LDLM_FL_LOCAL_ONLY              0x0000002000000000ULL // bit  37
207 #define ldlm_is_local_only(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 37)
208 #define ldlm_set_local_only(_l)         LDLM_SET_FLAG((  _l), 1ULL << 37)
209 #define ldlm_clear_local_only(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 37)
210
211 /** don't run the cancel callback under ldlm_cli_cancel_unused */
212 #define LDLM_FL_FAILED                  0x0000004000000000ULL // bit  38
213 #define ldlm_is_failed(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 38)
214 #define ldlm_set_failed(_l)             LDLM_SET_FLAG((  _l), 1ULL << 38)
215 #define ldlm_clear_failed(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 38)
216
217 /** lock cancel has already been sent */
218 #define LDLM_FL_CANCELING               0x0000008000000000ULL // bit  39
219 #define ldlm_is_canceling(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 39)
220 #define ldlm_set_canceling(_l)          LDLM_SET_FLAG((  _l), 1ULL << 39)
221 #define ldlm_clear_canceling(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 39)
222
223 /** local lock (ie, no srv/cli split) */
224 #define LDLM_FL_LOCAL                   0x0000010000000000ULL // bit  40
225 #define ldlm_is_local(_l)               LDLM_TEST_FLAG(( _l), 1ULL << 40)
226 #define ldlm_set_local(_l)              LDLM_SET_FLAG((  _l), 1ULL << 40)
227 #define ldlm_clear_local(_l)            LDLM_CLEAR_FLAG((_l), 1ULL << 40)
228
229 /**
230  * XXX FIXME: This is being added to b_size as a low-risk fix to the
231  * fact that the LVB filling happens _after_ the lock has been granted,
232  * so another thread can match it before the LVB has been updated.  As a
233  * dirty hack, we set LDLM_FL_LVB_READY only after we've done the LVB poop.
234  * this is only needed on LOV/OSC now, where LVB is actually used and
235  * callers must set it in input flags.
236  *
237  * The proper fix is to do the granting inside of the completion AST,
238  * which can be replaced with a LVB-aware wrapping function for OSC locks.
239  * That change is pretty high-risk, though, and would need a lot more
240  * testing. */
241 #define LDLM_FL_LVB_READY               0x0000020000000000ULL // bit  41
242 #define ldlm_is_lvb_ready(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 41)
243 #define ldlm_set_lvb_ready(_l)          LDLM_SET_FLAG((  _l), 1ULL << 41)
244 #define ldlm_clear_lvb_ready(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 41)
245
246 /**
247  * A lock contributes to the known minimum size (KMS) calculation until it
248  * has finished the part of its cancelation that performs write back on its
249  * dirty pages.  It can remain on the granted list during this whole time.
250  * Threads racing to update the KMS after performing their writeback need
251  * to know to exclude each other's locks from the calculation as they walk
252  * the granted list. */
253 #define LDLM_FL_KMS_IGNORE              0x0000040000000000ULL // bit  42
254 #define ldlm_is_kms_ignore(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 42)
255 #define ldlm_set_kms_ignore(_l)         LDLM_SET_FLAG((  _l), 1ULL << 42)
256 #define ldlm_clear_kms_ignore(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 42)
257
258 /** completion AST to be executed */
259 #define LDLM_FL_CP_REQD                 0x0000080000000000ULL // bit  43
260 #define ldlm_is_cp_reqd(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 43)
261 #define ldlm_set_cp_reqd(_l)            LDLM_SET_FLAG((  _l), 1ULL << 43)
262 #define ldlm_clear_cp_reqd(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 43)
263
264 /** cleanup_resource has already handled the lock */
265 #define LDLM_FL_CLEANED                 0x0000100000000000ULL // bit  44
266 #define ldlm_is_cleaned(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 44)
267 #define ldlm_set_cleaned(_l)            LDLM_SET_FLAG((  _l), 1ULL << 44)
268 #define ldlm_clear_cleaned(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 44)
269
270 /**
271  * optimization hint: LDLM can run blocking callback from current context
272  * w/o involving separate thread. in order to decrease cs rate */
273 #define LDLM_FL_ATOMIC_CB               0x0000200000000000ULL // bit  45
274 #define ldlm_is_atomic_cb(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 45)
275 #define ldlm_set_atomic_cb(_l)          LDLM_SET_FLAG((  _l), 1ULL << 45)
276 #define ldlm_clear_atomic_cb(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 45)
277
278 /**
279  * It may happen that a client initiates two operations, e.g. unlink and
280  * mkdir, such that the server sends a blocking AST for conflicting locks
281  * to this client for the first operation, whereas the second operation
282  * has canceled this lock and is waiting for rpc_lock which is taken by
283  * the first operation. LDLM_FL_BL_AST is set by ldlm_callback_handler() in
284  * the lock to prevent the Early Lock Cancel (ELC) code from cancelling it. */
285 #define LDLM_FL_BL_AST                  0x0000400000000000ULL // bit  46
286 #define ldlm_is_bl_ast(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 46)
287 #define ldlm_set_bl_ast(_l)             LDLM_SET_FLAG((  _l), 1ULL << 46)
288 #define ldlm_clear_bl_ast(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 46)
289
290 /**
291  * Set by ldlm_cancel_callback() when lock cache is dropped to let
292  * ldlm_callback_handler() return EINVAL to the server. It is used when
293  * ELC RPC is already prepared and is waiting for rpc_lock, too late to
294  * send a separate CANCEL RPC. */
295 #define LDLM_FL_BL_DONE                 0x0000800000000000ULL // bit  47
296 #define ldlm_is_bl_done(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 47)
297 #define ldlm_set_bl_done(_l)            LDLM_SET_FLAG((  _l), 1ULL << 47)
298 #define ldlm_clear_bl_done(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 47)
299
300 /**
301  * Don't put lock into the LRU list, so that it is not canceled due
302  * to aging.  Used by MGC locks, they are cancelled only at unmount or
303  * by callback. */
304 #define LDLM_FL_NO_LRU                  0x0001000000000000ULL // bit  48
305 #define ldlm_is_no_lru(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 48)
306 #define ldlm_set_no_lru(_l)             LDLM_SET_FLAG((  _l), 1ULL << 48)
307 #define ldlm_clear_no_lru(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 48)
308
309 /**
310  * Set for locks that failed and where the server has been notified.
311  *
312  * Protected by lock and resource locks. */
313 #define LDLM_FL_FAIL_NOTIFIED           0x0002000000000000ULL // bit  49
314 #define ldlm_is_fail_notified(_l)       LDLM_TEST_FLAG(( _l), 1ULL << 49)
315 #define ldlm_set_fail_notified(_l)      LDLM_SET_FLAG((  _l), 1ULL << 49)
316 #define ldlm_clear_fail_notified(_l)    LDLM_CLEAR_FLAG((_l), 1ULL << 49)
317
318 /**
319  * Set for locks that were removed from class hash table and will
320  * be destroyed when last reference to them is released. Set by
321  * ldlm_lock_destroy_internal().
322  *
323  * Protected by lock and resource locks. */
324 #define LDLM_FL_DESTROYED               0x0004000000000000ULL // bit  50
325 #define ldlm_is_destroyed(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 50)
326 #define ldlm_set_destroyed(_l)          LDLM_SET_FLAG((  _l), 1ULL << 50)
327 #define ldlm_clear_destroyed(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 50)
328
329 /** flag whether this is a server namespace lock */
330 #define LDLM_FL_SERVER_LOCK             0x0008000000000000ULL // bit  51
331 #define ldlm_is_server_lock(_l)         LDLM_TEST_FLAG(( _l), 1ULL << 51)
332 #define ldlm_set_server_lock(_l)        LDLM_SET_FLAG((  _l), 1ULL << 51)
333 #define ldlm_clear_server_lock(_l)      LDLM_CLEAR_FLAG((_l), 1ULL << 51)
334
335 /**
336  * It's set in lock_res_and_lock() and unset in unlock_res_and_lock().
337  *
338  * NB: compared with check_res_locked(), checking this bit is cheaper.
339  * Also, spin_is_locked() is deprecated for kernel code; one reason is
340  * because it works only for SMP so user needs to add extra macros like
341  * LASSERT_SPIN_LOCKED for uniprocessor kernels. */
342 #define LDLM_FL_RES_LOCKED              0x0010000000000000ULL // bit  52
343 #define ldlm_is_res_locked(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 52)
344 #define ldlm_set_res_locked(_l)         LDLM_SET_FLAG((  _l), 1ULL << 52)
345 #define ldlm_clear_res_locked(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 52)
346
347 /**
348  * It's set once we call ldlm_add_waiting_lock_res_locked() to start the
349  * lock-timeout timer and it will never be reset.
350  *
351  * Protected by lock and resource locks. */
352 #define LDLM_FL_WAITED                  0x0020000000000000ULL // bit  53
353 #define ldlm_is_waited(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 53)
354 #define ldlm_set_waited(_l)             LDLM_SET_FLAG((  _l), 1ULL << 53)
355 #define ldlm_clear_waited(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 53)
356
357 /** Flag whether this is a server namespace lock. */
358 #define LDLM_FL_NS_SRV                  0x0040000000000000ULL // bit  54
359 #define ldlm_is_ns_srv(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 54)
360 #define ldlm_set_ns_srv(_l)             LDLM_SET_FLAG((  _l), 1ULL << 54)
361 #define ldlm_clear_ns_srv(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 54)
362
363 /** Flag whether this lock can be reused. Used by exclusive open. */
364 #define LDLM_FL_EXCL                    0x0080000000000000ULL // bit  55
365 #define ldlm_is_excl(_l)                LDLM_TEST_FLAG(( _l), 1ULL << 55)
366 #define ldlm_set_excl(_l)               LDLM_SET_FLAG((  _l), 1ULL << 55)
367 #define ldlm_clear_excl(_l)             LDLM_CLEAR_FLAG((_l), 1ULL << 55)
368
369 /** test for ldlm_lock flag bit set */
370 #define LDLM_TEST_FLAG(_l, _b)    (((_l)->l_flags & (_b)) != 0)
371
372 /** multi-bit test: are any of mask bits set? */
373 #define LDLM_HAVE_MASK(_l, _m)    (((_l)->l_flags & LDLM_FL_##_m##_MASK) != 0)
374
375 /** set a ldlm_lock flag bit */
376 #define LDLM_SET_FLAG(_l, _b)     ((_l)->l_flags |= (_b))
377
378 /** clear a ldlm_lock flag bit */
379 #define LDLM_CLEAR_FLAG(_l, _b)   ((_l)->l_flags &= ~(_b))
380
381 /** @} subgroup */
382 /** @} group */
383 #endif /* LDLM_ALL_FLAGS_MASK */
384