diff options
Diffstat (limited to 'fs/ocfs2/stack_user.c')
| -rw-r--r-- | fs/ocfs2/stack_user.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index da78a2a334fd..5ae8812b2864 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> |
| @@ -63,8 +62,8 @@ | |||
| 63 | * negotiated by the client. The client negotiates based on the maximum | 62 | * negotiated by the client. The client negotiates based on the maximum |
| 64 | * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major | 63 | * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major |
| 65 | * number from the "SETV" message must match | 64 | * number from the "SETV" message must match |
| 66 | * ocfs2_user_plugin.sp_proto->lp_max_version.pv_major, and the minor number | 65 | * ocfs2_user_plugin.sp_max_proto.pv_major, and the minor number |
| 67 | * must be less than or equal to ...->lp_max_version.pv_minor. | 66 | * must be less than or equal to ...sp_max_version.pv_minor. |
| 68 | * | 67 | * |
| 69 | * Once this information has been set, mounts will be allowed. From this | 68 | * Once this information has been set, mounts will be allowed. From this |
| 70 | * point on, the "DOWN" message can be sent for node down notification. | 69 | * point on, the "DOWN" message can be sent for node down notification. |
| @@ -401,7 +400,7 @@ static int ocfs2_control_do_setversion_msg(struct file *file, | |||
| 401 | char *ptr = NULL; | 400 | char *ptr = NULL; |
| 402 | struct ocfs2_control_private *p = file->private_data; | 401 | struct ocfs2_control_private *p = file->private_data; |
| 403 | struct ocfs2_protocol_version *max = | 402 | struct ocfs2_protocol_version *max = |
| 404 | &ocfs2_user_plugin.sp_proto->lp_max_version; | 403 | &ocfs2_user_plugin.sp_max_proto; |
| 405 | 404 | ||
| 406 | if (ocfs2_control_get_handshake_state(file) != | 405 | if (ocfs2_control_get_handshake_state(file) != |
| 407 | OCFS2_CONTROL_HANDSHAKE_PROTOCOL) | 406 | OCFS2_CONTROL_HANDSHAKE_PROTOCOL) |
| @@ -664,18 +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 | struct ocfs2_dlm_lksb *lksb = astarg; |
| 676 | int status = lksb->sb_status; | 669 | int status = lksb->lksb_fsdlm.sb_status; |
| 677 | |||
| 678 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); | ||
| 679 | 670 | ||
| 680 | /* | 671 | /* |
| 681 | * For now we're punting on the issue of other non-standard errors | 672 | * For now we're punting on the issue of other non-standard errors |
| @@ -688,25 +679,24 @@ static void fsdlm_lock_ast_wrapper(void *astarg) | |||
| 688 | */ | 679 | */ |
| 689 | 680 | ||
| 690 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) | 681 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) |
| 691 | ocfs2_user_plugin.sp_proto->lp_unlock_ast(astarg, 0); | 682 | lksb->lksb_conn->cc_proto->lp_unlock_ast(lksb, 0); |
| 692 | else | 683 | else |
| 693 | ocfs2_user_plugin.sp_proto->lp_lock_ast(astarg); | 684 | lksb->lksb_conn->cc_proto->lp_lock_ast(lksb); |
| 694 | } | 685 | } |
| 695 | 686 | ||
| 696 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) | 687 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) |
| 697 | { | 688 | { |
| 698 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); | 689 | struct ocfs2_dlm_lksb *lksb = astarg; |
| 699 | 690 | ||
| 700 | ocfs2_user_plugin.sp_proto->lp_blocking_ast(astarg, level); | 691 | lksb->lksb_conn->cc_proto->lp_blocking_ast(lksb, level); |
| 701 | } | 692 | } |
| 702 | 693 | ||
| 703 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, | 694 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, |
| 704 | int mode, | 695 | int mode, |
| 705 | union ocfs2_dlm_lksb *lksb, | 696 | struct ocfs2_dlm_lksb *lksb, |
| 706 | u32 flags, | 697 | u32 flags, |
| 707 | void *name, | 698 | void *name, |
| 708 | unsigned int namelen, | 699 | unsigned int namelen) |
| 709 | void *astarg) | ||
| 710 | { | 700 | { |
| 711 | int ret; | 701 | int ret; |
| 712 | 702 | ||
| @@ -716,36 +706,35 @@ static int user_dlm_lock(struct ocfs2_cluster_connection *conn, | |||
| 716 | 706 | ||
| 717 | ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm, | 707 | ret = dlm_lock(conn->cc_lockspace, mode, &lksb->lksb_fsdlm, |
| 718 | flags|DLM_LKF_NODLCKWT, name, namelen, 0, | 708 | flags|DLM_LKF_NODLCKWT, name, namelen, 0, |
| 719 | fsdlm_lock_ast_wrapper, astarg, | 709 | fsdlm_lock_ast_wrapper, lksb, |
| 720 | fsdlm_blocking_ast_wrapper); | 710 | fsdlm_blocking_ast_wrapper); |
| 721 | return ret; | 711 | return ret; |
| 722 | } | 712 | } |
| 723 | 713 | ||
| 724 | static int user_dlm_unlock(struct ocfs2_cluster_connection *conn, | 714 | static int user_dlm_unlock(struct ocfs2_cluster_connection *conn, |
| 725 | union ocfs2_dlm_lksb *lksb, | 715 | struct ocfs2_dlm_lksb *lksb, |
| 726 | u32 flags, | 716 | u32 flags) |
| 727 | void *astarg) | ||
| 728 | { | 717 | { |
| 729 | int ret; | 718 | int ret; |
| 730 | 719 | ||
| 731 | ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid, | 720 | ret = dlm_unlock(conn->cc_lockspace, lksb->lksb_fsdlm.sb_lkid, |
| 732 | flags, &lksb->lksb_fsdlm, astarg); | 721 | flags, &lksb->lksb_fsdlm, lksb); |
| 733 | return ret; | 722 | return ret; |
| 734 | } | 723 | } |
| 735 | 724 | ||
| 736 | static int user_dlm_lock_status(union ocfs2_dlm_lksb *lksb) | 725 | static int user_dlm_lock_status(struct ocfs2_dlm_lksb *lksb) |
| 737 | { | 726 | { |
| 738 | return lksb->lksb_fsdlm.sb_status; | 727 | return lksb->lksb_fsdlm.sb_status; |
| 739 | } | 728 | } |
| 740 | 729 | ||
| 741 | static int user_dlm_lvb_valid(union ocfs2_dlm_lksb *lksb) | 730 | static int user_dlm_lvb_valid(struct ocfs2_dlm_lksb *lksb) |
| 742 | { | 731 | { |
| 743 | int invalid = lksb->lksb_fsdlm.sb_flags & DLM_SBF_VALNOTVALID; | 732 | int invalid = lksb->lksb_fsdlm.sb_flags & DLM_SBF_VALNOTVALID; |
| 744 | 733 | ||
| 745 | return !invalid; | 734 | return !invalid; |
| 746 | } | 735 | } |
| 747 | 736 | ||
| 748 | static void *user_dlm_lvb(union ocfs2_dlm_lksb *lksb) | 737 | static void *user_dlm_lvb(struct ocfs2_dlm_lksb *lksb) |
| 749 | { | 738 | { |
| 750 | if (!lksb->lksb_fsdlm.sb_lvbptr) | 739 | if (!lksb->lksb_fsdlm.sb_lvbptr) |
| 751 | lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb + | 740 | lksb->lksb_fsdlm.sb_lvbptr = (char *)lksb + |
| @@ -753,7 +742,7 @@ static void *user_dlm_lvb(union ocfs2_dlm_lksb *lksb) | |||
| 753 | return (void *)(lksb->lksb_fsdlm.sb_lvbptr); | 742 | return (void *)(lksb->lksb_fsdlm.sb_lvbptr); |
| 754 | } | 743 | } |
| 755 | 744 | ||
| 756 | static void user_dlm_dump_lksb(union ocfs2_dlm_lksb *lksb) | 745 | static void user_dlm_dump_lksb(struct ocfs2_dlm_lksb *lksb) |
| 757 | { | 746 | { |
| 758 | } | 747 | } |
| 759 | 748 | ||
