aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2007-10-05 17:31:44 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2008-01-25 17:46:04 -0500
commitd69a3ad6a0e47b2aa9b2b2ddfd385752132a4d34 (patch)
tree8e4a3283e9ce892217f69b1066d7933908652b00
parente63aecb651ba73dffc62f9608ee1b7ae2a0ffd4b (diff)
dlm: Split lock mode and flag constants into a sharable header.
This allows others to use the DLM constants without being tied to the function API of fs/dlm. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/dlm.h140
-rw-r--r--include/linux/dlmconstants.h159
3 files changed, 162 insertions, 138 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index f30fa92a44a1..bd694f779346 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -49,6 +49,7 @@ header-y += comstats.h
49header-y += const.h 49header-y += const.h
50header-y += cgroupstats.h 50header-y += cgroupstats.h
51header-y += cycx_cfm.h 51header-y += cycx_cfm.h
52header-y += dlmconstants.h
52header-y += dlm_device.h 53header-y += dlm_device.h
53header-y += dlm_netlink.h 54header-y += dlm_netlink.h
54header-y += dm-ioctl.h 55header-y += dm-ioctl.h
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index be9d278761e0..c743fbc769db 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -19,148 +19,12 @@
19 * routines and structures to use DLM lockspaces 19 * routines and structures to use DLM lockspaces
20 */ 20 */
21 21
22/* 22/* Lock levels and flags are here */
23 * Lock Modes 23#include <linux/dlmconstants.h>
24 */
25 24
26#define DLM_LOCK_IV -1 /* invalid */
27#define DLM_LOCK_NL 0 /* null */
28#define DLM_LOCK_CR 1 /* concurrent read */
29#define DLM_LOCK_CW 2 /* concurrent write */
30#define DLM_LOCK_PR 3 /* protected read */
31#define DLM_LOCK_PW 4 /* protected write */
32#define DLM_LOCK_EX 5 /* exclusive */
33
34/*
35 * Maximum size in bytes of a dlm_lock name
36 */
37 25
38#define DLM_RESNAME_MAXLEN 64 26#define DLM_RESNAME_MAXLEN 64
39 27
40/*
41 * Flags to dlm_lock
42 *
43 * DLM_LKF_NOQUEUE
44 *
45 * Do not queue the lock request on the wait queue if it cannot be granted
46 * immediately. If the lock cannot be granted because of this flag, DLM will
47 * either return -EAGAIN from the dlm_lock call or will return 0 from
48 * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
49 *
50 * DLM_LKF_CANCEL
51 *
52 * Used to cancel a pending lock request or conversion. A converting lock is
53 * returned to its previously granted mode.
54 *
55 * DLM_LKF_CONVERT
56 *
57 * Indicates a lock conversion request. For conversions the name and namelen
58 * are ignored and the lock ID in the LKSB is used to identify the lock.
59 *
60 * DLM_LKF_VALBLK
61 *
62 * Requests DLM to return the current contents of the lock value block in the
63 * lock status block. When this flag is set in a lock conversion from PW or EX
64 * modes, DLM assigns the value specified in the lock status block to the lock
65 * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
66 * containing application-specific information.
67 *
68 * DLM_LKF_QUECVT
69 *
70 * Force a conversion request to be queued, even if it is compatible with
71 * the granted modes of other locks on the same resource.
72 *
73 * DLM_LKF_IVVALBLK
74 *
75 * Invalidate the lock value block.
76 *
77 * DLM_LKF_CONVDEADLK
78 *
79 * Allows the dlm to resolve conversion deadlocks internally by demoting the
80 * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
81 * returned for a conversion that's been effected by this.
82 *
83 * DLM_LKF_PERSISTENT
84 *
85 * Only relevant to locks originating in userspace. A persistent lock will not
86 * be removed if the process holding the lock exits.
87 *
88 * DLM_LKF_NODLCKWT
89 *
90 * Do not cancel the lock if it gets into conversion deadlock.
91 * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
92 *
93 * DLM_LKF_NODLCKBLK
94 *
95 * net yet implemented
96 *
97 * DLM_LKF_EXPEDITE
98 *
99 * Used only with new requests for NL mode locks. Tells the lock manager
100 * to grant the lock, ignoring other locks in convert and wait queues.
101 *
102 * DLM_LKF_NOQUEUEBAST
103 *
104 * Send blocking AST's before returning -EAGAIN to the caller. It is only
105 * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
106 * NOQUEUE requests otherwise.
107 *
108 * DLM_LKF_HEADQUE
109 *
110 * Add a lock to the head of the convert or wait queue rather than the tail.
111 *
112 * DLM_LKF_NOORDER
113 *
114 * Disregard the standard grant order rules and grant a lock as soon as it
115 * is compatible with other granted locks.
116 *
117 * DLM_LKF_ORPHAN
118 *
119 * not yet implemented
120 *
121 * DLM_LKF_ALTPR
122 *
123 * If the requested mode cannot be granted immediately, try to grant the lock
124 * in PR mode instead. If this alternate mode is granted instead of the
125 * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
126 *
127 * DLM_LKF_ALTCW
128 *
129 * The same as ALTPR, but the alternate mode is CW.
130 *
131 * DLM_LKF_FORCEUNLOCK
132 *
133 * Unlock the lock even if it is converting or waiting or has sublocks.
134 * Only really for use by the userland device.c code.
135 *
136 */
137
138#define DLM_LKF_NOQUEUE 0x00000001
139#define DLM_LKF_CANCEL 0x00000002
140#define DLM_LKF_CONVERT 0x00000004
141#define DLM_LKF_VALBLK 0x00000008
142#define DLM_LKF_QUECVT 0x00000010
143#define DLM_LKF_IVVALBLK 0x00000020
144#define DLM_LKF_CONVDEADLK 0x00000040
145#define DLM_LKF_PERSISTENT 0x00000080
146#define DLM_LKF_NODLCKWT 0x00000100
147#define DLM_LKF_NODLCKBLK 0x00000200
148#define DLM_LKF_EXPEDITE 0x00000400
149#define DLM_LKF_NOQUEUEBAST 0x00000800
150#define DLM_LKF_HEADQUE 0x00001000
151#define DLM_LKF_NOORDER 0x00002000
152#define DLM_LKF_ORPHAN 0x00004000
153#define DLM_LKF_ALTPR 0x00008000
154#define DLM_LKF_ALTCW 0x00010000
155#define DLM_LKF_FORCEUNLOCK 0x00020000
156#define DLM_LKF_TIMEOUT 0x00040000
157
158/*
159 * Some return codes that are not in errno.h
160 */
161
162#define DLM_ECANCEL 0x10001
163#define DLM_EUNLOCK 0x10002
164 28
165typedef void dlm_lockspace_t; 29typedef void dlm_lockspace_t;
166 30
diff --git a/include/linux/dlmconstants.h b/include/linux/dlmconstants.h
new file mode 100644
index 000000000000..fddb3d3ff321
--- /dev/null
+++ b/include/linux/dlmconstants.h
@@ -0,0 +1,159 @@
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
6**
7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions
9** of the GNU General Public License v.2.
10**
11*******************************************************************************
12******************************************************************************/
13
14#ifndef __DLMCONSTANTS_DOT_H__
15#define __DLMCONSTANTS_DOT_H__
16
17/*
18 * Constants used by DLM interface.
19 */
20
21/*
22 * Lock Modes
23 */
24
25#define DLM_LOCK_IV (-1) /* invalid */
26#define DLM_LOCK_NL 0 /* null */
27#define DLM_LOCK_CR 1 /* concurrent read */
28#define DLM_LOCK_CW 2 /* concurrent write */
29#define DLM_LOCK_PR 3 /* protected read */
30#define DLM_LOCK_PW 4 /* protected write */
31#define DLM_LOCK_EX 5 /* exclusive */
32
33
34/*
35 * Flags to dlm_lock
36 *
37 * DLM_LKF_NOQUEUE
38 *
39 * Do not queue the lock request on the wait queue if it cannot be granted
40 * immediately. If the lock cannot be granted because of this flag, DLM will
41 * either return -EAGAIN from the dlm_lock call or will return 0 from
42 * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
43 *
44 * DLM_LKF_CANCEL
45 *
46 * Used to cancel a pending lock request or conversion. A converting lock is
47 * returned to its previously granted mode.
48 *
49 * DLM_LKF_CONVERT
50 *
51 * Indicates a lock conversion request. For conversions the name and namelen
52 * are ignored and the lock ID in the LKSB is used to identify the lock.
53 *
54 * DLM_LKF_VALBLK
55 *
56 * Requests DLM to return the current contents of the lock value block in the
57 * lock status block. When this flag is set in a lock conversion from PW or EX
58 * modes, DLM assigns the value specified in the lock status block to the lock
59 * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
60 * containing application-specific information.
61 *
62 * DLM_LKF_QUECVT
63 *
64 * Force a conversion request to be queued, even if it is compatible with
65 * the granted modes of other locks on the same resource.
66 *
67 * DLM_LKF_IVVALBLK
68 *
69 * Invalidate the lock value block.
70 *
71 * DLM_LKF_CONVDEADLK
72 *
73 * Allows the dlm to resolve conversion deadlocks internally by demoting the
74 * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
75 * returned for a conversion that's been effected by this.
76 *
77 * DLM_LKF_PERSISTENT
78 *
79 * Only relevant to locks originating in userspace. A persistent lock will not
80 * be removed if the process holding the lock exits.
81 *
82 * DLM_LKF_NODLCKWT
83 *
84 * Do not cancel the lock if it gets into conversion deadlock.
85 * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
86 *
87 * DLM_LKF_NODLCKBLK
88 *
89 * net yet implemented
90 *
91 * DLM_LKF_EXPEDITE
92 *
93 * Used only with new requests for NL mode locks. Tells the lock manager
94 * to grant the lock, ignoring other locks in convert and wait queues.
95 *
96 * DLM_LKF_NOQUEUEBAST
97 *
98 * Send blocking AST's before returning -EAGAIN to the caller. It is only
99 * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
100 * NOQUEUE requests otherwise.
101 *
102 * DLM_LKF_HEADQUE
103 *
104 * Add a lock to the head of the convert or wait queue rather than the tail.
105 *
106 * DLM_LKF_NOORDER
107 *
108 * Disregard the standard grant order rules and grant a lock as soon as it
109 * is compatible with other granted locks.
110 *
111 * DLM_LKF_ORPHAN
112 *
113 * not yet implemented
114 *
115 * DLM_LKF_ALTPR
116 *
117 * If the requested mode cannot be granted immediately, try to grant the lock
118 * in PR mode instead. If this alternate mode is granted instead of the
119 * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
120 *
121 * DLM_LKF_ALTCW
122 *
123 * The same as ALTPR, but the alternate mode is CW.
124 *
125 * DLM_LKF_FORCEUNLOCK
126 *
127 * Unlock the lock even if it is converting or waiting or has sublocks.
128 * Only really for use by the userland device.c code.
129 *
130 */
131
132#define DLM_LKF_NOQUEUE 0x00000001
133#define DLM_LKF_CANCEL 0x00000002
134#define DLM_LKF_CONVERT 0x00000004
135#define DLM_LKF_VALBLK 0x00000008
136#define DLM_LKF_QUECVT 0x00000010
137#define DLM_LKF_IVVALBLK 0x00000020
138#define DLM_LKF_CONVDEADLK 0x00000040
139#define DLM_LKF_PERSISTENT 0x00000080
140#define DLM_LKF_NODLCKWT 0x00000100
141#define DLM_LKF_NODLCKBLK 0x00000200
142#define DLM_LKF_EXPEDITE 0x00000400
143#define DLM_LKF_NOQUEUEBAST 0x00000800
144#define DLM_LKF_HEADQUE 0x00001000
145#define DLM_LKF_NOORDER 0x00002000
146#define DLM_LKF_ORPHAN 0x00004000
147#define DLM_LKF_ALTPR 0x00008000
148#define DLM_LKF_ALTCW 0x00010000
149#define DLM_LKF_FORCEUNLOCK 0x00020000
150#define DLM_LKF_TIMEOUT 0x00040000
151
152/*
153 * Some return codes that are not in errno.h
154 */
155
156#define DLM_ECANCEL 0x10001
157#define DLM_EUNLOCK 0x10002
158
159#endif /* __DLMCONSTANTS_DOT_H__ */