Whamcloud - gitweb
LU-2771 dlmlock: compress out unused space
[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          0x007FFFFFC08F132FULL
39
40 /** l_flags bits marked as "ast" bits */
41 #define LDLM_FL_AST_MASK                0x0000000080000000ULL
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 "hide_lock" bits */
50 #define LDLM_FL_HIDE_LOCK_MASK          0x0000206400000000ULL
51
52 /** l_flags bits marked as "inherit" bits */
53 #define LDLM_FL_INHERIT_MASK            0x0000000000800000ULL
54
55 /** l_flags bits marked as "local_only" bits */
56 #define LDLM_FL_LOCAL_ONLY_MASK         0x007FFFFF00000000ULL
57
58 /** l_flags bits marked as "on_wire" bits */
59 #define LDLM_FL_ON_WIRE_MASK            0x00000000C08F132FULL
60
61 /** extent, mode, or resource changed */
62 #define LDLM_FL_LOCK_CHANGED            0x0000000000000001ULL // bit   0
63 #define ldlm_is_lock_changed(_l)        LDLM_TEST_FLAG(( _l), 1ULL <<  0)
64 #define ldlm_set_lock_changed(_l)       LDLM_SET_FLAG((  _l), 1ULL <<  0)
65 #define ldlm_clear_lock_changed(_l)     LDLM_CLEAR_FLAG((_l), 1ULL <<  0)
66
67 /**
68  * Server placed lock on granted list, or a recovering client wants the
69  * lock added to the granted list, no questions asked. */
70 #define LDLM_FL_BLOCK_GRANTED           0x0000000000000002ULL // bit   1
71 #define ldlm_is_block_granted(_l)       LDLM_TEST_FLAG(( _l), 1ULL <<  1)
72 #define ldlm_set_block_granted(_l)      LDLM_SET_FLAG((  _l), 1ULL <<  1)
73 #define ldlm_clear_block_granted(_l)    LDLM_CLEAR_FLAG((_l), 1ULL <<  1)
74
75 /**
76  * Server placed lock on conv list, or a recovering client wants the lock
77  * added to the conv list, no questions asked. */
78 #define LDLM_FL_BLOCK_CONV              0x0000000000000004ULL // bit   2
79 #define ldlm_is_block_conv(_l)          LDLM_TEST_FLAG(( _l), 1ULL <<  2)
80 #define ldlm_set_block_conv(_l)         LDLM_SET_FLAG((  _l), 1ULL <<  2)
81 #define ldlm_clear_block_conv(_l)       LDLM_CLEAR_FLAG((_l), 1ULL <<  2)
82
83 /**
84  * Server placed lock on wait list, or a recovering client wants the lock
85  * added to the wait list, no questions asked. */
86 #define LDLM_FL_BLOCK_WAIT              0x0000000000000008ULL // bit   3
87 #define ldlm_is_block_wait(_l)          LDLM_TEST_FLAG(( _l), 1ULL <<  3)
88 #define ldlm_set_block_wait(_l)         LDLM_SET_FLAG((  _l), 1ULL <<  3)
89 #define ldlm_clear_block_wait(_l)       LDLM_CLEAR_FLAG((_l), 1ULL <<  3)
90
91 /** blocking or cancel packet was queued for sending. */
92 #define LDLM_FL_AST_SENT                0x0000000000000020ULL // bit   5
93 #define ldlm_is_ast_sent(_l)            LDLM_TEST_FLAG(( _l), 1ULL <<  5)
94 #define ldlm_set_ast_sent(_l)           LDLM_SET_FLAG((  _l), 1ULL <<  5)
95 #define ldlm_clear_ast_sent(_l)         LDLM_CLEAR_FLAG((_l), 1ULL <<  5)
96
97 /**
98  * Lock is being replayed.  This could probably be implied by the fact that
99  * one of BLOCK_{GRANTED,CONV,WAIT} is set, but that is pretty dangerous. */
100 #define LDLM_FL_REPLAY                  0x0000000000000100ULL // bit   8
101 #define ldlm_is_replay(_l)              LDLM_TEST_FLAG(( _l), 1ULL <<  8)
102 #define ldlm_set_replay(_l)             LDLM_SET_FLAG((  _l), 1ULL <<  8)
103 #define ldlm_clear_replay(_l)           LDLM_CLEAR_FLAG((_l), 1ULL <<  8)
104
105 /** Don't grant lock, just do intent. */
106 #define LDLM_FL_INTENT_ONLY             0x0000000000000200ULL // bit   9
107 #define ldlm_is_intent_only(_l)         LDLM_TEST_FLAG(( _l), 1ULL <<  9)
108 #define ldlm_set_intent_only(_l)        LDLM_SET_FLAG((  _l), 1ULL <<  9)
109 #define ldlm_clear_intent_only(_l)      LDLM_CLEAR_FLAG((_l), 1ULL <<  9)
110
111 /** lock request has intent */
112 #define LDLM_FL_HAS_INTENT              0x0000000000001000ULL // bit  12
113 #define ldlm_is_has_intent(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 12)
114 #define ldlm_set_has_intent(_l)         LDLM_SET_FLAG((  _l), 1ULL << 12)
115 #define ldlm_clear_has_intent(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 12)
116
117 /** discard (no writeback) on cancel */
118 #define LDLM_FL_DISCARD_DATA            0x0000000000010000ULL // bit  16
119 #define ldlm_is_discard_data(_l)        LDLM_TEST_FLAG(( _l), 1ULL << 16)
120 #define ldlm_set_discard_data(_l)       LDLM_SET_FLAG((  _l), 1ULL << 16)
121 #define ldlm_clear_discard_data(_l)     LDLM_CLEAR_FLAG((_l), 1ULL << 16)
122
123 /** Blocked by group lock - wait indefinitely */
124 #define LDLM_FL_NO_TIMEOUT              0x0000000000020000ULL // bit  17
125 #define ldlm_is_no_timeout(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 17)
126 #define ldlm_set_no_timeout(_l)         LDLM_SET_FLAG((  _l), 1ULL << 17)
127 #define ldlm_clear_no_timeout(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 17)
128
129 /**
130  * Server told not to wait if blocked. For AGL, OST will not send glimpse
131  * callback. */
132 #define LDLM_FL_BLOCK_NOWAIT            0x0000000000040000ULL // bit  18
133 #define ldlm_is_block_nowait(_l)        LDLM_TEST_FLAG(( _l), 1ULL << 18)
134 #define ldlm_set_block_nowait(_l)       LDLM_SET_FLAG((  _l), 1ULL << 18)
135 #define ldlm_clear_block_nowait(_l)     LDLM_CLEAR_FLAG((_l), 1ULL << 18)
136
137 /** return blocking lock */
138 #define LDLM_FL_TEST_LOCK               0x0000000000080000ULL // bit  19
139 #define ldlm_is_test_lock(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 19)
140 #define ldlm_set_test_lock(_l)          LDLM_SET_FLAG((  _l), 1ULL << 19)
141 #define ldlm_clear_test_lock(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 19)
142
143 /**
144  * Immediatelly cancel such locks when they block some other locks. Send
145  * cancel notification to original lock holder, but expect no reply. This
146  * is for clients (like liblustre) that cannot be expected to reliably
147  * response to blocking AST. */
148 #define LDLM_FL_CANCEL_ON_BLOCK         0x0000000000800000ULL // bit  23
149 #define ldlm_is_cancel_on_block(_l)     LDLM_TEST_FLAG(( _l), 1ULL << 23)
150 #define ldlm_set_cancel_on_block(_l)    LDLM_SET_FLAG((  _l), 1ULL << 23)
151 #define ldlm_clear_cancel_on_block(_l)  LDLM_CLEAR_FLAG((_l), 1ULL << 23)
152
153 /**
154  * measure lock contention and return -EUSERS if locking contention is high */
155 #define LDLM_FL_DENY_ON_CONTENTION        0x0000000040000000ULL // bit  30
156 #define ldlm_is_deny_on_contention(_l)    LDLM_TEST_FLAG(( _l), 1ULL << 30)
157 #define ldlm_set_deny_on_contention(_l)   LDLM_SET_FLAG((  _l), 1ULL << 30)
158 #define ldlm_clear_deny_on_contention(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 30)
159
160 /**
161  * These are flags that are mapped into the flags and ASTs of blocking
162  * locks Add FL_DISCARD to blocking ASTs */
163 #define LDLM_FL_AST_DISCARD_DATA        0x0000000080000000ULL // bit  31
164 #define ldlm_is_ast_discard_data(_l)    LDLM_TEST_FLAG(( _l), 1ULL << 31)
165 #define ldlm_set_ast_discard_data(_l)   LDLM_SET_FLAG((  _l), 1ULL << 31)
166 #define ldlm_clear_ast_discard_data(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 31)
167
168 /**
169  * Used for marking lock as a target for -EINTR while cp_ast sleep emulation
170  * + race with upcoming bl_ast. */
171 #define LDLM_FL_FAIL_LOC                0x0000000100000000ULL // bit  32
172 #define ldlm_is_fail_loc(_l)            LDLM_TEST_FLAG(( _l), 1ULL << 32)
173 #define ldlm_set_fail_loc(_l)           LDLM_SET_FLAG((  _l), 1ULL << 32)
174 #define ldlm_clear_fail_loc(_l)         LDLM_CLEAR_FLAG((_l), 1ULL << 32)
175
176 /**
177  * Used while processing the unused list to know that we have already
178  * handled this lock and decided to skip it. */
179 #define LDLM_FL_SKIPPED                 0x0000000200000000ULL // bit  33
180 #define ldlm_is_skipped(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 33)
181 #define ldlm_set_skipped(_l)            LDLM_SET_FLAG((  _l), 1ULL << 33)
182 #define ldlm_clear_skipped(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 33)
183
184 /** this lock is being destroyed */
185 #define LDLM_FL_CBPENDING               0x0000000400000000ULL // bit  34
186 #define ldlm_is_cbpending(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 34)
187 #define ldlm_set_cbpending(_l)          LDLM_SET_FLAG((  _l), 1ULL << 34)
188 #define ldlm_clear_cbpending(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 34)
189
190 /** not a real flag, not saved in lock */
191 #define LDLM_FL_WAIT_NOREPROC           0x0000000800000000ULL // bit  35
192 #define ldlm_is_wait_noreproc(_l)       LDLM_TEST_FLAG(( _l), 1ULL << 35)
193 #define ldlm_set_wait_noreproc(_l)      LDLM_SET_FLAG((  _l), 1ULL << 35)
194 #define ldlm_clear_wait_noreproc(_l)    LDLM_CLEAR_FLAG((_l), 1ULL << 35)
195
196 /** cancellation callback already run */
197 #define LDLM_FL_CANCEL                  0x0000001000000000ULL // bit  36
198 #define ldlm_is_cancel(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 36)
199 #define ldlm_set_cancel(_l)             LDLM_SET_FLAG((  _l), 1ULL << 36)
200 #define ldlm_clear_cancel(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 36)
201
202 /** whatever it might mean */
203 #define LDLM_FL_LOCAL_ONLY              0x0000002000000000ULL // bit  37
204 #define ldlm_is_local_only(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 37)
205 #define ldlm_set_local_only(_l)         LDLM_SET_FLAG((  _l), 1ULL << 37)
206 #define ldlm_clear_local_only(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 37)
207
208 /** don't run the cancel callback under ldlm_cli_cancel_unused */
209 #define LDLM_FL_FAILED                  0x0000004000000000ULL // bit  38
210 #define ldlm_is_failed(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 38)
211 #define ldlm_set_failed(_l)             LDLM_SET_FLAG((  _l), 1ULL << 38)
212 #define ldlm_clear_failed(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 38)
213
214 /** lock cancel has already been sent */
215 #define LDLM_FL_CANCELING               0x0000008000000000ULL // bit  39
216 #define ldlm_is_canceling(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 39)
217 #define ldlm_set_canceling(_l)          LDLM_SET_FLAG((  _l), 1ULL << 39)
218 #define ldlm_clear_canceling(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 39)
219
220 /** local lock (ie, no srv/cli split) */
221 #define LDLM_FL_LOCAL                   0x0000010000000000ULL // bit  40
222 #define ldlm_is_local(_l)               LDLM_TEST_FLAG(( _l), 1ULL << 40)
223 #define ldlm_set_local(_l)              LDLM_SET_FLAG((  _l), 1ULL << 40)
224 #define ldlm_clear_local(_l)            LDLM_CLEAR_FLAG((_l), 1ULL << 40)
225
226 /**
227  * XXX FIXME: This is being added to b_size as a low-risk fix to the
228  * fact that the LVB filling happens _after_ the lock has been granted,
229  * so another thread can match it before the LVB has been updated.  As a
230  * dirty hack, we set LDLM_FL_LVB_READY only after we've done the LVB poop.
231  * this is only needed on LOV/OSC now, where LVB is actually used and
232  * callers must set it in input flags.
233  *
234  * The proper fix is to do the granting inside of the completion AST,
235  * which can be replaced with a LVB-aware wrapping function for OSC locks.
236  * That change is pretty high-risk, though, and would need a lot more
237  * testing. */
238 #define LDLM_FL_LVB_READY               0x0000020000000000ULL // bit  41
239 #define ldlm_is_lvb_ready(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 41)
240 #define ldlm_set_lvb_ready(_l)          LDLM_SET_FLAG((  _l), 1ULL << 41)
241 #define ldlm_clear_lvb_ready(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 41)
242
243 /**
244  * A lock contributes to the known minimum size (KMS) calculation until it
245  * has finished the part of its cancelation that performs write back on its
246  * dirty pages.  It can remain on the granted list during this whole time.
247  * Threads racing to update the KMS after performing their writeback need
248  * to know to exclude each other's locks from the calculation as they walk
249  * the granted list. */
250 #define LDLM_FL_KMS_IGNORE              0x0000040000000000ULL // bit  42
251 #define ldlm_is_kms_ignore(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 42)
252 #define ldlm_set_kms_ignore(_l)         LDLM_SET_FLAG((  _l), 1ULL << 42)
253 #define ldlm_clear_kms_ignore(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 42)
254
255 /** completion AST to be executed */
256 #define LDLM_FL_CP_REQD                 0x0000080000000000ULL // bit  43
257 #define ldlm_is_cp_reqd(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 43)
258 #define ldlm_set_cp_reqd(_l)            LDLM_SET_FLAG((  _l), 1ULL << 43)
259 #define ldlm_clear_cp_reqd(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 43)
260
261 /** cleanup_resource has already handled the lock */
262 #define LDLM_FL_CLEANED                 0x0000100000000000ULL // bit  44
263 #define ldlm_is_cleaned(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 44)
264 #define ldlm_set_cleaned(_l)            LDLM_SET_FLAG((  _l), 1ULL << 44)
265 #define ldlm_clear_cleaned(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 44)
266
267 /**
268  * optimization hint: LDLM can run blocking callback from current context
269  * w/o involving separate thread. in order to decrease cs rate */
270 #define LDLM_FL_ATOMIC_CB               0x0000200000000000ULL // bit  45
271 #define ldlm_is_atomic_cb(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 45)
272 #define ldlm_set_atomic_cb(_l)          LDLM_SET_FLAG((  _l), 1ULL << 45)
273 #define ldlm_clear_atomic_cb(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 45)
274
275 /**
276  * It may happen that a client initiates two operations, e.g. unlink and
277  * mkdir, such that the server sends a blocking AST for conflicting locks
278  * to this client for the first operation, whereas the second operation
279  * has canceled this lock and is waiting for rpc_lock which is taken by
280  * the first operation. LDLM_FL_BL_AST is set by ldlm_callback_handler() in
281  * the lock to prevent the Early Lock Cancel (ELC) code from cancelling it.
282  *
283  * LDLM_FL_BL_DONE is to be set by ldlm_cancel_callback() when lock cache is
284  * dropped to let ldlm_callback_handler() return EINVAL to the server. It
285  * is used when ELC RPC is already prepared and is waiting for rpc_lock,
286  * too late to send a separate CANCEL RPC. */
287 #define LDLM_FL_BL_AST                  0x0000400000000000ULL // bit  46
288 #define ldlm_is_bl_ast(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 46)
289 #define ldlm_set_bl_ast(_l)             LDLM_SET_FLAG((  _l), 1ULL << 46)
290 #define ldlm_clear_bl_ast(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 46)
291
292 /** whatever it might mean */
293 #define LDLM_FL_BL_DONE                 0x0000800000000000ULL // bit  47
294 #define ldlm_is_bl_done(_l)             LDLM_TEST_FLAG(( _l), 1ULL << 47)
295 #define ldlm_set_bl_done(_l)            LDLM_SET_FLAG((  _l), 1ULL << 47)
296 #define ldlm_clear_bl_done(_l)          LDLM_CLEAR_FLAG((_l), 1ULL << 47)
297
298 /**
299  * Don't put lock into the LRU list, so that it is not canceled due
300  * to aging.  Used by MGC locks, they are cancelled only at unmount or
301  * by callback. */
302 #define LDLM_FL_NO_LRU                  0x0001000000000000ULL // bit  48
303 #define ldlm_is_no_lru(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 48)
304 #define ldlm_set_no_lru(_l)             LDLM_SET_FLAG((  _l), 1ULL << 48)
305 #define ldlm_clear_no_lru(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 48)
306
307 /**
308  * Set for locks that failed and where the server has been notified.
309  *
310  * Protected by lock and resource locks. */
311 #define LDLM_FL_FAIL_NOTIFIED           0x0002000000000000ULL // bit  49
312 #define ldlm_is_fail_notified(_l)       LDLM_TEST_FLAG(( _l), 1ULL << 49)
313 #define ldlm_set_fail_notified(_l)      LDLM_SET_FLAG((  _l), 1ULL << 49)
314 #define ldlm_clear_fail_notified(_l)    LDLM_CLEAR_FLAG((_l), 1ULL << 49)
315
316 /**
317  * Set for locks that were removed from class hash table and will
318  * be destroyed when last reference to them is released. Set by
319  * ldlm_lock_destroy_internal().
320  *
321  * Protected by lock and resource locks. */
322 #define LDLM_FL_DESTROYED               0x0004000000000000ULL // bit  50
323 #define ldlm_is_destroyed(_l)           LDLM_TEST_FLAG(( _l), 1ULL << 50)
324 #define ldlm_set_destroyed(_l)          LDLM_SET_FLAG((  _l), 1ULL << 50)
325 #define ldlm_clear_destroyed(_l)        LDLM_CLEAR_FLAG((_l), 1ULL << 50)
326
327 /** flag whether this is a server namespace lock */
328 #define LDLM_FL_SERVER_LOCK             0x0008000000000000ULL // bit  51
329 #define ldlm_is_server_lock(_l)         LDLM_TEST_FLAG(( _l), 1ULL << 51)
330 #define ldlm_set_server_lock(_l)        LDLM_SET_FLAG((  _l), 1ULL << 51)
331 #define ldlm_clear_server_lock(_l)      LDLM_CLEAR_FLAG((_l), 1ULL << 51)
332
333 /**
334  * It's set in lock_res_and_lock() and unset in unlock_res_and_lock().
335  *
336  * NB: compared with check_res_locked(), checking this bit is cheaper.
337  * Also, spin_is_locked() is deprecated for kernel code; one reason is
338  * because it works only for SMP so user needs to add extra macros like
339  * LASSERT_SPIN_LOCKED for uniprocessor kernels. */
340 #define LDLM_FL_RES_LOCKED              0x0010000000000000ULL // bit  52
341 #define ldlm_is_res_locked(_l)          LDLM_TEST_FLAG(( _l), 1ULL << 52)
342 #define ldlm_set_res_locked(_l)         LDLM_SET_FLAG((  _l), 1ULL << 52)
343 #define ldlm_clear_res_locked(_l)       LDLM_CLEAR_FLAG((_l), 1ULL << 52)
344
345 /**
346  * It's set once we call ldlm_add_waiting_lock_res_locked() to start the
347  * lock-timeout timer and it will never be reset.
348  *
349  * Protected by lock and resource locks. */
350 #define LDLM_FL_WAITED                  0x0020000000000000ULL // bit  53
351 #define ldlm_is_waited(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 53)
352 #define ldlm_set_waited(_l)             LDLM_SET_FLAG((  _l), 1ULL << 53)
353 #define ldlm_clear_waited(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 53)
354
355 /** Flag whether this is a server namespace lock. */
356 #define LDLM_FL_NS_SRV                  0x0040000000000000ULL // bit  54
357 #define ldlm_is_ns_srv(_l)              LDLM_TEST_FLAG(( _l), 1ULL << 54)
358 #define ldlm_set_ns_srv(_l)             LDLM_SET_FLAG((  _l), 1ULL << 54)
359 #define ldlm_clear_ns_srv(_l)           LDLM_CLEAR_FLAG((_l), 1ULL << 54)
360
361 /** test for ldlm_lock flag bit set */
362 #define LDLM_TEST_FLAG(_l, _b)        (((_l)->l_flags & (_b)) != 0)
363
364 /** set a ldlm_lock flag bit */
365 #define LDLM_SET_FLAG(_l, _b)         (((_l)->l_flags |= (_b))
366
367 /** clear a ldlm_lock flag bit */
368 #define LDLM_CLEAR_FLAG(_l, _b)       (((_l)->l_flags &= ~(_b))
369
370 /** Mask of flags inherited from parent lock when doing intents. */
371 #define LDLM_INHERIT_FLAGS            LDLM_FL_INHERIT_MASK
372
373 /** Mask of Flags sent in AST lock_flags to map into the receiving lock. */
374 #define LDLM_AST_FLAGS                LDLM_FL_AST_MASK
375
376 /** @} subgroup */
377 /** @} group */
378 #ifdef WIRESHARK_COMPILE
379 static int hf_lustre_ldlm_fl_lock_changed        = -1;
380 static int hf_lustre_ldlm_fl_block_granted       = -1;
381 static int hf_lustre_ldlm_fl_block_conv          = -1;
382 static int hf_lustre_ldlm_fl_block_wait          = -1;
383 static int hf_lustre_ldlm_fl_ast_sent            = -1;
384 static int hf_lustre_ldlm_fl_replay              = -1;
385 static int hf_lustre_ldlm_fl_intent_only         = -1;
386 static int hf_lustre_ldlm_fl_has_intent          = -1;
387 static int hf_lustre_ldlm_fl_discard_data        = -1;
388 static int hf_lustre_ldlm_fl_no_timeout          = -1;
389 static int hf_lustre_ldlm_fl_block_nowait        = -1;
390 static int hf_lustre_ldlm_fl_test_lock           = -1;
391 static int hf_lustre_ldlm_fl_cancel_on_block     = -1;
392 static int hf_lustre_ldlm_fl_deny_on_contention  = -1;
393 static int hf_lustre_ldlm_fl_ast_discard_data    = -1;
394 static int hf_lustre_ldlm_fl_fail_loc            = -1;
395 static int hf_lustre_ldlm_fl_skipped             = -1;
396 static int hf_lustre_ldlm_fl_cbpending           = -1;
397 static int hf_lustre_ldlm_fl_wait_noreproc       = -1;
398 static int hf_lustre_ldlm_fl_cancel              = -1;
399 static int hf_lustre_ldlm_fl_local_only          = -1;
400 static int hf_lustre_ldlm_fl_failed              = -1;
401 static int hf_lustre_ldlm_fl_canceling           = -1;
402 static int hf_lustre_ldlm_fl_local               = -1;
403 static int hf_lustre_ldlm_fl_lvb_ready           = -1;
404 static int hf_lustre_ldlm_fl_kms_ignore          = -1;
405 static int hf_lustre_ldlm_fl_cp_reqd             = -1;
406 static int hf_lustre_ldlm_fl_cleaned             = -1;
407 static int hf_lustre_ldlm_fl_atomic_cb           = -1;
408 static int hf_lustre_ldlm_fl_bl_ast              = -1;
409 static int hf_lustre_ldlm_fl_bl_done             = -1;
410 static int hf_lustre_ldlm_fl_no_lru              = -1;
411 static int hf_lustre_ldlm_fl_fail_notified       = -1;
412 static int hf_lustre_ldlm_fl_destroyed           = -1;
413 static int hf_lustre_ldlm_fl_server_lock         = -1;
414 static int hf_lustre_ldlm_fl_res_locked          = -1;
415 static int hf_lustre_ldlm_fl_waited              = -1;
416 static int hf_lustre_ldlm_fl_ns_srv              = -1;
417
418 const value_string lustre_ldlm_flags_vals[] = {
419   {LDLM_FL_LOCK_CHANGED,        "LDLM_FL_LOCK_CHANGED"},
420   {LDLM_FL_BLOCK_GRANTED,       "LDLM_FL_BLOCK_GRANTED"},
421   {LDLM_FL_BLOCK_CONV,          "LDLM_FL_BLOCK_CONV"},
422   {LDLM_FL_BLOCK_WAIT,          "LDLM_FL_BLOCK_WAIT"},
423   {LDLM_FL_AST_SENT,            "LDLM_FL_AST_SENT"},
424   {LDLM_FL_REPLAY,              "LDLM_FL_REPLAY"},
425   {LDLM_FL_INTENT_ONLY,         "LDLM_FL_INTENT_ONLY"},
426   {LDLM_FL_HAS_INTENT,          "LDLM_FL_HAS_INTENT"},
427   {LDLM_FL_DISCARD_DATA,        "LDLM_FL_DISCARD_DATA"},
428   {LDLM_FL_NO_TIMEOUT,          "LDLM_FL_NO_TIMEOUT"},
429   {LDLM_FL_BLOCK_NOWAIT,        "LDLM_FL_BLOCK_NOWAIT"},
430   {LDLM_FL_TEST_LOCK,           "LDLM_FL_TEST_LOCK"},
431   {LDLM_FL_CANCEL_ON_BLOCK,     "LDLM_FL_CANCEL_ON_BLOCK"},
432   {LDLM_FL_DENY_ON_CONTENTION,  "LDLM_FL_DENY_ON_CONTENTION"},
433   {LDLM_FL_AST_DISCARD_DATA,    "LDLM_FL_AST_DISCARD_DATA"},
434   {LDLM_FL_FAIL_LOC,            "LDLM_FL_FAIL_LOC"},
435   {LDLM_FL_SKIPPED,             "LDLM_FL_SKIPPED"},
436   {LDLM_FL_CBPENDING,           "LDLM_FL_CBPENDING"},
437   {LDLM_FL_WAIT_NOREPROC,       "LDLM_FL_WAIT_NOREPROC"},
438   {LDLM_FL_CANCEL,              "LDLM_FL_CANCEL"},
439   {LDLM_FL_LOCAL_ONLY,          "LDLM_FL_LOCAL_ONLY"},
440   {LDLM_FL_FAILED,              "LDLM_FL_FAILED"},
441   {LDLM_FL_CANCELING,           "LDLM_FL_CANCELING"},
442   {LDLM_FL_LOCAL,               "LDLM_FL_LOCAL"},
443   {LDLM_FL_LVB_READY,           "LDLM_FL_LVB_READY"},
444   {LDLM_FL_KMS_IGNORE,          "LDLM_FL_KMS_IGNORE"},
445   {LDLM_FL_CP_REQD,             "LDLM_FL_CP_REQD"},
446   {LDLM_FL_CLEANED,             "LDLM_FL_CLEANED"},
447   {LDLM_FL_ATOMIC_CB,           "LDLM_FL_ATOMIC_CB"},
448   {LDLM_FL_BL_AST,              "LDLM_FL_BL_AST"},
449   {LDLM_FL_BL_DONE,             "LDLM_FL_BL_DONE"},
450   {LDLM_FL_NO_LRU,              "LDLM_FL_NO_LRU"},
451   {LDLM_FL_FAIL_NOTIFIED,       "LDLM_FL_FAIL_NOTIFIED"},
452   {LDLM_FL_DESTROYED,           "LDLM_FL_DESTROYED"},
453   {LDLM_FL_SERVER_LOCK,         "LDLM_FL_SERVER_LOCK"},
454   {LDLM_FL_RES_LOCKED,          "LDLM_FL_RES_LOCKED"},
455   {LDLM_FL_WAITED,              "LDLM_FL_WAITED"},
456   {LDLM_FL_NS_SRV,              "LDLM_FL_NS_SRV"},
457   { 0, NULL }
458 };
459 #endif /*  WIRESHARK_COMPILE */
460 #endif /* LDLM_ALL_FLAGS_MASK */