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/stack_user.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/stack_user.c')
-rw-r--r-- | fs/ocfs2/stack_user.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index da78a2a334fd..129b93159cca 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/reboot.h> | 25 | #include <linux/reboot.h> |
26 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | 27 | ||
28 | #include "ocfs2.h" /* For struct ocfs2_lock_res */ | ||
29 | #include "stackglue.h" | 28 | #include "stackglue.h" |
30 | 29 | ||
31 | #include <linux/dlm_plock.h> | 30 | #include <linux/dlm_plock.h> |
@@ -664,16 +663,10 @@ static void ocfs2_control_exit(void) | |||
664 | -rc); | 663 | -rc); |
665 | } | 664 | } |
666 | 665 | ||
667 | static struct dlm_lksb *fsdlm_astarg_to_lksb(void *astarg) | ||
668 | { | ||
669 | struct ocfs2_lock_res *res = astarg; | ||
670 | return &res->l_lksb.lksb_fsdlm; | ||
671 | } | ||
672 | |||
673 | static void fsdlm_lock_ast_wrapper(void *astarg) | 666 | static void fsdlm_lock_ast_wrapper(void *astarg) |
674 | { | 667 | { |
675 | struct dlm_lksb *lksb = fsdlm_astarg_to_lksb(astarg); | 668 | union ocfs2_dlm_lksb *lksb = astarg; |
676 | int status = lksb->sb_status; | 669 | int status = lksb->lksb_fsdlm.sb_status; |
677 | 670 | ||
678 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); | 671 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); |
679 | 672 | ||
@@ -688,16 +681,18 @@ static void fsdlm_lock_ast_wrapper(void *astarg) | |||
688 | */ | 681 | */ |
689 | 682 | ||
690 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) | 683 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) |
691 | ocfs2_user_plugin.sp_proto->lp_unlock_ast(astarg, 0); | 684 | ocfs2_user_plugin.sp_proto->lp_unlock_ast(lksb, 0); |
692 | else | 685 | else |
693 | ocfs2_user_plugin.sp_proto->lp_lock_ast(astarg); | 686 | ocfs2_user_plugin.sp_proto->lp_lock_ast(lksb); |
694 | } | 687 | } |
695 | 688 | ||
696 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) | 689 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) |
697 | { | 690 | { |
691 | union ocfs2_dlm_lksb *lksb = astarg; | ||
692 | |||
698 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); | 693 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); |
699 | 694 | ||
700 | ocfs2_user_plugin.sp_proto->lp_blocking_ast(astarg, level); | 695 | ocfs2_user_plugin.sp_proto->lp_blocking_ast(lksb, level); |
701 | } | 696 | } |
702 | 697 | ||
703 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, | 698 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, |
@@ -705,8 +700,7 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn, | |||
705 | union ocfs2_dlm_lksb *lksb, | 700 | union ocfs2_dlm_lksb *lksb, |
706 | u32 flags, | 701 | u32 flags, |
707 | void *name, | 702 | void *name, |
708 | unsigned int namelen, | 703 | unsigned int namelen) |
709 | void *astarg) | ||
710 | { | 704 | { |
711 | int ret; | 705 | int ret; |
712 | 706 | ||
@@ -716,20 +710,19 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn, | |||
716 | 710 | ||
717 | ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm, | 711 | ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm, |
718 | flags|DLM_LKF_NODLCKWT, name, namelen, 0, | 712 | flags|DLM_LKF_NODLCKWT, name, namelen, 0, |
719 | fsdlm_lock_ast_wrapper, astarg, | 713 | fsdlm_lock_ast_wrapper, lksb, |
720 | fsdlm_blocking_ast_wrapper); | 714 | fsdlm_blocking_ast_wrapper); |
721 | return ret; | 715 | return ret; |
722 | } | 716 | } |
723 | 717 | ||
724 | static int user_dlm_unlock(struct ocfs2_cluster_connection *conn, | 718 | static int user_dlm_unlock(struct ocfs2_cluster_connection *conn, |
725 | union ocfs2_dlm_lksb *lksb, | 719 | union ocfs2_dlm_lksb *lksb, |
726 | u32 flags, | 720 | u32 flags) |
727 | void *astarg) | ||
728 | { | 721 | { |
729 | int ret; | 722 | int ret; |
730 | 723 | ||
731 | ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid, | 724 | ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid, |
732 | flags, &lksb->lksb_fsdlm, astarg); | 725 | flags, &lksb->lksb_fsdlm, lksb); |
733 | return ret; | 726 | return ret; |
734 | } | 727 | } |
735 | 728 | ||