diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-01-29 20:37:32 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-04-18 11:56:03 -0400 |
commit | 24ef1815e5e13e50196eb1ab8ddc0d783443bdf8 (patch) | |
tree | 4c44e87b1a80d4745416c9973258c40db8433829 /fs/ocfs2/stackglue.c | |
parent | 386a2ef8576e966076c293f6496b9e3d7e3d9035 (diff) |
ocfs2: Separate out dlm lock functions.
This is the first in a series of patches to isolate ocfs2 from the
underlying cluster stack. Here we wrap the dlm locking functions with
ocfs2-specific calls. Because ocfs2 always uses the same dlm lock status
callbacks, we can eliminate the callbacks from the filesystem visible
functions.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/stackglue.c')
-rw-r--r-- | fs/ocfs2/stackglue.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c new file mode 100644 index 000000000000..4f44f23795f0 --- /dev/null +++ b/fs/ocfs2/stackglue.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8; -*- | ||
2 | * vim: noexpandtab sw=8 ts=8 sts=0: | ||
3 | * | ||
4 | * stackglue.c | ||
5 | * | ||
6 | * Code which implements an OCFS2 specific interface to underlying | ||
7 | * cluster stacks. | ||
8 | * | ||
9 | * Copyright (C) 2007 Oracle. All rights reserved. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public | ||
13 | * License as published by the Free Software Foundation, version 2. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
18 | * General Public License for more details. | ||
19 | */ | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <linux/list.h> | ||
23 | |||
24 | #include "dlm/dlmapi.h" | ||
25 | |||
26 | #include "stackglue.h" | ||
27 | |||
28 | static struct ocfs2_locking_protocol *lproto; | ||
29 | |||
30 | enum dlm_status ocfs2_dlm_lock(struct dlm_ctxt *dlm, | ||
31 | int mode, | ||
32 | struct dlm_lockstatus *lksb, | ||
33 | u32 flags, | ||
34 | void *name, | ||
35 | unsigned int namelen, | ||
36 | void *astarg) | ||
37 | { | ||
38 | BUG_ON(lproto == NULL); | ||
39 | return dlmlock(dlm, mode, lksb, flags, name, namelen, | ||
40 | lproto->lp_lock_ast, astarg, | ||
41 | lproto->lp_blocking_ast); | ||
42 | } | ||
43 | |||
44 | enum dlm_status ocfs2_dlm_unlock(struct dlm_ctxt *dlm, | ||
45 | struct dlm_lockstatus *lksb, | ||
46 | u32 flags, | ||
47 | void *astarg) | ||
48 | { | ||
49 | BUG_ON(lproto == NULL); | ||
50 | |||
51 | return dlmunlock(dlm, lksb, flags, lproto->lp_unlock_ast, astarg); | ||
52 | } | ||
53 | |||
54 | |||
55 | void o2cb_get_stack(struct ocfs2_locking_protocol *proto) | ||
56 | { | ||
57 | BUG_ON(proto == NULL); | ||
58 | |||
59 | lproto = proto; | ||
60 | } | ||
61 | |||
62 | void o2cb_put_stack(void) | ||
63 | { | ||
64 | lproto = NULL; | ||
65 | } | ||