diff options
Diffstat (limited to 'fs/gfs2/glock.h')
-rw-r--r-- | fs/gfs2/glock.h | 127 |
1 files changed, 123 insertions, 4 deletions
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index 543ec7ecfbda..a602a28f6f08 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -11,15 +11,130 @@ | |||
11 | #define __GLOCK_DOT_H__ | 11 | #define __GLOCK_DOT_H__ |
12 | 12 | ||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/parser.h> | ||
14 | #include "incore.h" | 15 | #include "incore.h" |
15 | 16 | ||
16 | /* Flags for lock requests; used in gfs2_holder gh_flag field. | 17 | /* Options for hostdata parser */ |
17 | From lm_interface.h: | 18 | |
19 | enum { | ||
20 | Opt_jid, | ||
21 | Opt_id, | ||
22 | Opt_first, | ||
23 | Opt_nodir, | ||
24 | Opt_err, | ||
25 | }; | ||
26 | |||
27 | /* | ||
28 | * lm_lockname types | ||
29 | */ | ||
30 | |||
31 | #define LM_TYPE_RESERVED 0x00 | ||
32 | #define LM_TYPE_NONDISK 0x01 | ||
33 | #define LM_TYPE_INODE 0x02 | ||
34 | #define LM_TYPE_RGRP 0x03 | ||
35 | #define LM_TYPE_META 0x04 | ||
36 | #define LM_TYPE_IOPEN 0x05 | ||
37 | #define LM_TYPE_FLOCK 0x06 | ||
38 | #define LM_TYPE_PLOCK 0x07 | ||
39 | #define LM_TYPE_QUOTA 0x08 | ||
40 | #define LM_TYPE_JOURNAL 0x09 | ||
41 | |||
42 | /* | ||
43 | * lm_lock() states | ||
44 | * | ||
45 | * SHARED is compatible with SHARED, not with DEFERRED or EX. | ||
46 | * DEFERRED is compatible with DEFERRED, not with SHARED or EX. | ||
47 | */ | ||
48 | |||
49 | #define LM_ST_UNLOCKED 0 | ||
50 | #define LM_ST_EXCLUSIVE 1 | ||
51 | #define LM_ST_DEFERRED 2 | ||
52 | #define LM_ST_SHARED 3 | ||
53 | |||
54 | /* | ||
55 | * lm_lock() flags | ||
56 | * | ||
57 | * LM_FLAG_TRY | ||
58 | * Don't wait to acquire the lock if it can't be granted immediately. | ||
59 | * | ||
60 | * LM_FLAG_TRY_1CB | ||
61 | * Send one blocking callback if TRY is set and the lock is not granted. | ||
62 | * | ||
63 | * LM_FLAG_NOEXP | ||
64 | * GFS sets this flag on lock requests it makes while doing journal recovery. | ||
65 | * These special requests should not be blocked due to the recovery like | ||
66 | * ordinary locks would be. | ||
67 | * | ||
68 | * LM_FLAG_ANY | ||
69 | * A SHARED request may also be granted in DEFERRED, or a DEFERRED request may | ||
70 | * also be granted in SHARED. The preferred state is whichever is compatible | ||
71 | * with other granted locks, or the specified state if no other locks exist. | ||
72 | * | ||
73 | * LM_FLAG_PRIORITY | ||
74 | * Override fairness considerations. Suppose a lock is held in a shared state | ||
75 | * and there is a pending request for the deferred state. A shared lock | ||
76 | * request with the priority flag would be allowed to bypass the deferred | ||
77 | * request and directly join the other shared lock. A shared lock request | ||
78 | * without the priority flag might be forced to wait until the deferred | ||
79 | * requested had acquired and released the lock. | ||
80 | */ | ||
81 | |||
18 | #define LM_FLAG_TRY 0x00000001 | 82 | #define LM_FLAG_TRY 0x00000001 |
19 | #define LM_FLAG_TRY_1CB 0x00000002 | 83 | #define LM_FLAG_TRY_1CB 0x00000002 |
20 | #define LM_FLAG_NOEXP 0x00000004 | 84 | #define LM_FLAG_NOEXP 0x00000004 |
21 | #define LM_FLAG_ANY 0x00000008 | 85 | #define LM_FLAG_ANY 0x00000008 |
22 | #define LM_FLAG_PRIORITY 0x00000010 */ | 86 | #define LM_FLAG_PRIORITY 0x00000010 |
87 | #define GL_ASYNC 0x00000040 | ||
88 | #define GL_EXACT 0x00000080 | ||
89 | #define GL_SKIP 0x00000100 | ||
90 | #define GL_ATIME 0x00000200 | ||
91 | #define GL_NOCACHE 0x00000400 | ||
92 | |||
93 | /* | ||
94 | * lm_lock() and lm_async_cb return flags | ||
95 | * | ||
96 | * LM_OUT_ST_MASK | ||
97 | * Masks the lower two bits of lock state in the returned value. | ||
98 | * | ||
99 | * LM_OUT_CANCELED | ||
100 | * The lock request was canceled. | ||
101 | * | ||
102 | * LM_OUT_ASYNC | ||
103 | * The result of the request will be returned in an LM_CB_ASYNC callback. | ||
104 | * | ||
105 | */ | ||
106 | |||
107 | #define LM_OUT_ST_MASK 0x00000003 | ||
108 | #define LM_OUT_CANCELED 0x00000008 | ||
109 | #define LM_OUT_ASYNC 0x00000080 | ||
110 | #define LM_OUT_ERROR 0x00000100 | ||
111 | |||
112 | /* | ||
113 | * lm_recovery_done() messages | ||
114 | */ | ||
115 | |||
116 | #define LM_RD_GAVEUP 308 | ||
117 | #define LM_RD_SUCCESS 309 | ||
118 | |||
119 | #define GLR_TRYFAILED 13 | ||
120 | |||
121 | struct lm_lockops { | ||
122 | const char *lm_proto_name; | ||
123 | int (*lm_mount) (struct gfs2_sbd *sdp, const char *fsname); | ||
124 | void (*lm_unmount) (struct gfs2_sbd *sdp); | ||
125 | void (*lm_withdraw) (struct gfs2_sbd *sdp); | ||
126 | void (*lm_put_lock) (struct kmem_cache *cachep, void *gl); | ||
127 | unsigned int (*lm_lock) (struct gfs2_glock *gl, | ||
128 | unsigned int req_state, unsigned int flags); | ||
129 | void (*lm_cancel) (struct gfs2_glock *gl); | ||
130 | const match_table_t *lm_tokens; | ||
131 | }; | ||
132 | |||
133 | #define LM_FLAG_TRY 0x00000001 | ||
134 | #define LM_FLAG_TRY_1CB 0x00000002 | ||
135 | #define LM_FLAG_NOEXP 0x00000004 | ||
136 | #define LM_FLAG_ANY 0x00000008 | ||
137 | #define LM_FLAG_PRIORITY 0x00000010 | ||
23 | 138 | ||
24 | #define GL_ASYNC 0x00000040 | 139 | #define GL_ASYNC 0x00000040 |
25 | #define GL_EXACT 0x00000080 | 140 | #define GL_EXACT 0x00000080 |
@@ -128,10 +243,12 @@ static inline int gfs2_glock_nq_init(struct gfs2_glock *gl, | |||
128 | int gfs2_lvb_hold(struct gfs2_glock *gl); | 243 | int gfs2_lvb_hold(struct gfs2_glock *gl); |
129 | void gfs2_lvb_unhold(struct gfs2_glock *gl); | 244 | void gfs2_lvb_unhold(struct gfs2_glock *gl); |
130 | 245 | ||
131 | void gfs2_glock_cb(void *cb_data, unsigned int type, void *data); | 246 | void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state); |
247 | void gfs2_glock_complete(struct gfs2_glock *gl, int ret); | ||
132 | void gfs2_reclaim_glock(struct gfs2_sbd *sdp); | 248 | void gfs2_reclaim_glock(struct gfs2_sbd *sdp); |
133 | void gfs2_gl_hash_clear(struct gfs2_sbd *sdp); | 249 | void gfs2_gl_hash_clear(struct gfs2_sbd *sdp); |
134 | void gfs2_glock_finish_truncate(struct gfs2_inode *ip); | 250 | void gfs2_glock_finish_truncate(struct gfs2_inode *ip); |
251 | void gfs2_glock_thaw(struct gfs2_sbd *sdp); | ||
135 | 252 | ||
136 | int __init gfs2_glock_init(void); | 253 | int __init gfs2_glock_init(void); |
137 | void gfs2_glock_exit(void); | 254 | void gfs2_glock_exit(void); |
@@ -141,4 +258,6 @@ void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp); | |||
141 | int gfs2_register_debugfs(void); | 258 | int gfs2_register_debugfs(void); |
142 | void gfs2_unregister_debugfs(void); | 259 | void gfs2_unregister_debugfs(void); |
143 | 260 | ||
261 | extern const struct lm_lockops gfs2_dlm_ops; | ||
262 | |||
144 | #endif /* __GLOCK_DOT_H__ */ | 263 | #endif /* __GLOCK_DOT_H__ */ |