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