diff options
author | Joel Becker <joel.becker@oracle.com> | 2010-01-28 22:22:39 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-02-26 18:41:14 -0500 |
commit | a796d2862aed8117acc9f470f3429a5ee852912e (patch) | |
tree | 71b837ae91effcdb4283e8c0bbf5c3162e7e21e1 /fs/ocfs2/dlmglue.c | |
parent | 34a9dd7e29e9129fec40c645a03f1bbbe810e771 (diff) |
ocfs2: Pass lksbs back from stackglue ast/bast functions.
The stackglue ast and bast functions tried to maintain the fiction that
their arguments were void pointers. In reality, stack_user.c had to
know that the argument was an ocfs2_lock_res in order to get the status
off of the lksb. That's ugly.
This changes stackglue to always pass the lksb as the argument to ast
and bast functions. The caller can always use container_of() to get the
ocfs2_lock_res or user_dlm_lock_res. The net effect to the caller is
zero. They still get back the lockres in their ast. stackglue gets
cleaner, and now can use the lksb itself.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlmglue.c')
-rw-r--r-- | fs/ocfs2/dlmglue.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index e044019cb3b1..1ba67df00924 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -297,6 +297,11 @@ static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres) | |||
297 | lockres->l_type == OCFS2_LOCK_TYPE_OPEN; | 297 | lockres->l_type == OCFS2_LOCK_TYPE_OPEN; |
298 | } | 298 | } |
299 | 299 | ||
300 | static inline struct ocfs2_lock_res *ocfs2_lksb_to_lock_res(union ocfs2_dlm_lksb *lksb) | ||
301 | { | ||
302 | return container_of(lksb, struct ocfs2_lock_res, l_lksb); | ||
303 | } | ||
304 | |||
300 | static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres) | 305 | static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres) |
301 | { | 306 | { |
302 | BUG_ON(!ocfs2_is_inode_lock(lockres)); | 307 | BUG_ON(!ocfs2_is_inode_lock(lockres)); |
@@ -1041,9 +1046,9 @@ static unsigned int lockres_set_pending(struct ocfs2_lock_res *lockres) | |||
1041 | } | 1046 | } |
1042 | 1047 | ||
1043 | 1048 | ||
1044 | static void ocfs2_blocking_ast(void *opaque, int level) | 1049 | static void ocfs2_blocking_ast(union ocfs2_dlm_lksb *lksb, int level) |
1045 | { | 1050 | { |
1046 | struct ocfs2_lock_res *lockres = opaque; | 1051 | struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb); |
1047 | struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); | 1052 | struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); |
1048 | int needs_downconvert; | 1053 | int needs_downconvert; |
1049 | unsigned long flags; | 1054 | unsigned long flags; |
@@ -1072,9 +1077,9 @@ static void ocfs2_blocking_ast(void *opaque, int level) | |||
1072 | ocfs2_wake_downconvert_thread(osb); | 1077 | ocfs2_wake_downconvert_thread(osb); |
1073 | } | 1078 | } |
1074 | 1079 | ||
1075 | static void ocfs2_locking_ast(void *opaque) | 1080 | static void ocfs2_locking_ast(union ocfs2_dlm_lksb *lksb) |
1076 | { | 1081 | { |
1077 | struct ocfs2_lock_res *lockres = opaque; | 1082 | struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb); |
1078 | struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); | 1083 | struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); |
1079 | unsigned long flags; | 1084 | unsigned long flags; |
1080 | int status; | 1085 | int status; |
@@ -1189,8 +1194,7 @@ static int ocfs2_lock_create(struct ocfs2_super *osb, | |||
1189 | &lockres->l_lksb, | 1194 | &lockres->l_lksb, |
1190 | dlm_flags, | 1195 | dlm_flags, |
1191 | lockres->l_name, | 1196 | lockres->l_name, |
1192 | OCFS2_LOCK_ID_MAX_LEN - 1, | 1197 | OCFS2_LOCK_ID_MAX_LEN - 1); |
1193 | lockres); | ||
1194 | lockres_clear_pending(lockres, gen, osb); | 1198 | lockres_clear_pending(lockres, gen, osb); |
1195 | if (ret) { | 1199 | if (ret) { |
1196 | ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); | 1200 | ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); |
@@ -1421,8 +1425,7 @@ again: | |||
1421 | &lockres->l_lksb, | 1425 | &lockres->l_lksb, |
1422 | lkm_flags, | 1426 | lkm_flags, |
1423 | lockres->l_name, | 1427 | lockres->l_name, |
1424 | OCFS2_LOCK_ID_MAX_LEN - 1, | 1428 | OCFS2_LOCK_ID_MAX_LEN - 1); |
1425 | lockres); | ||
1426 | lockres_clear_pending(lockres, gen, osb); | 1429 | lockres_clear_pending(lockres, gen, osb); |
1427 | if (ret) { | 1430 | if (ret) { |
1428 | if (!(lkm_flags & DLM_LKF_NOQUEUE) || | 1431 | if (!(lkm_flags & DLM_LKF_NOQUEUE) || |
@@ -1859,8 +1862,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock) | |||
1859 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 1862 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
1860 | 1863 | ||
1861 | ret = ocfs2_dlm_lock(osb->cconn, level, &lockres->l_lksb, lkm_flags, | 1864 | ret = ocfs2_dlm_lock(osb->cconn, level, &lockres->l_lksb, lkm_flags, |
1862 | lockres->l_name, OCFS2_LOCK_ID_MAX_LEN - 1, | 1865 | lockres->l_name, OCFS2_LOCK_ID_MAX_LEN - 1); |
1863 | lockres); | ||
1864 | if (ret) { | 1866 | if (ret) { |
1865 | if (!trylock || (ret != -EAGAIN)) { | 1867 | if (!trylock || (ret != -EAGAIN)) { |
1866 | ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); | 1868 | ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); |
@@ -3056,9 +3058,9 @@ void ocfs2_dlm_shutdown(struct ocfs2_super *osb, | |||
3056 | mlog_exit_void(); | 3058 | mlog_exit_void(); |
3057 | } | 3059 | } |
3058 | 3060 | ||
3059 | static void ocfs2_unlock_ast(void *opaque, int error) | 3061 | static void ocfs2_unlock_ast(union ocfs2_dlm_lksb *lksb, int error) |
3060 | { | 3062 | { |
3061 | struct ocfs2_lock_res *lockres = opaque; | 3063 | struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb); |
3062 | unsigned long flags; | 3064 | unsigned long flags; |
3063 | 3065 | ||
3064 | mlog_entry_void(); | 3066 | mlog_entry_void(); |
@@ -3167,8 +3169,7 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb, | |||
3167 | 3169 | ||
3168 | mlog(0, "lock %s\n", lockres->l_name); | 3170 | mlog(0, "lock %s\n", lockres->l_name); |
3169 | 3171 | ||
3170 | ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, lkm_flags, | 3172 | ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, lkm_flags); |
3171 | lockres); | ||
3172 | if (ret) { | 3173 | if (ret) { |
3173 | ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres); | 3174 | ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres); |
3174 | mlog(ML_ERROR, "lockres flags: %lu\n", lockres->l_flags); | 3175 | mlog(ML_ERROR, "lockres flags: %lu\n", lockres->l_flags); |
@@ -3309,8 +3310,7 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb, | |||
3309 | &lockres->l_lksb, | 3310 | &lockres->l_lksb, |
3310 | dlm_flags, | 3311 | dlm_flags, |
3311 | lockres->l_name, | 3312 | lockres->l_name, |
3312 | OCFS2_LOCK_ID_MAX_LEN - 1, | 3313 | OCFS2_LOCK_ID_MAX_LEN - 1); |
3313 | lockres); | ||
3314 | lockres_clear_pending(lockres, generation, osb); | 3314 | lockres_clear_pending(lockres, generation, osb); |
3315 | if (ret) { | 3315 | if (ret) { |
3316 | ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); | 3316 | ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres); |
@@ -3365,7 +3365,7 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb, | |||
3365 | mlog(0, "lock %s\n", lockres->l_name); | 3365 | mlog(0, "lock %s\n", lockres->l_name); |
3366 | 3366 | ||
3367 | ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, | 3367 | ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, |
3368 | DLM_LKF_CANCEL, lockres); | 3368 | DLM_LKF_CANCEL); |
3369 | if (ret) { | 3369 | if (ret) { |
3370 | ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres); | 3370 | ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres); |
3371 | ocfs2_recover_from_dlm_error(lockres, 0); | 3371 | ocfs2_recover_from_dlm_error(lockres, 0); |