diff options
author | David Teigland <teigland@redhat.com> | 2008-02-06 01:35:45 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2008-02-06 01:35:45 -0500 |
commit | e5dae548b0b5397e070de793be925cfc5813ad95 (patch) | |
tree | 5ad4c94cbeab745fc1bac3426423c405971c6796 /fs/dlm/lock.c | |
parent | cb79f1998d89821a4dbac47f59a46ee3fbbf3c61 (diff) |
dlm: proper types for asts and basts
Use proper types for ast and bast functions, and use
consistent type for ast param.
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lock.c')
-rw-r--r-- | fs/dlm/lock.c | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 5b82187e0221..94f8cbd3c0be 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -1781,7 +1781,7 @@ static void grant_pending_locks(struct dlm_rsb *r) | |||
1781 | */ | 1781 | */ |
1782 | 1782 | ||
1783 | list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) { | 1783 | list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) { |
1784 | if (lkb->lkb_bastaddr && lock_requires_bast(lkb, high, cw)) { | 1784 | if (lkb->lkb_bastfn && lock_requires_bast(lkb, high, cw)) { |
1785 | if (cw && high == DLM_LOCK_PR) | 1785 | if (cw && high == DLM_LOCK_PR) |
1786 | queue_bast(r, lkb, DLM_LOCK_CW); | 1786 | queue_bast(r, lkb, DLM_LOCK_CW); |
1787 | else | 1787 | else |
@@ -1811,7 +1811,7 @@ static void send_bast_queue(struct dlm_rsb *r, struct list_head *head, | |||
1811 | struct dlm_lkb *gr; | 1811 | struct dlm_lkb *gr; |
1812 | 1812 | ||
1813 | list_for_each_entry(gr, head, lkb_statequeue) { | 1813 | list_for_each_entry(gr, head, lkb_statequeue) { |
1814 | if (gr->lkb_bastaddr && modes_require_bast(gr, lkb)) { | 1814 | if (gr->lkb_bastfn && modes_require_bast(gr, lkb)) { |
1815 | queue_bast(r, gr, lkb->lkb_rqmode); | 1815 | queue_bast(r, gr, lkb->lkb_rqmode); |
1816 | gr->lkb_highbast = lkb->lkb_rqmode; | 1816 | gr->lkb_highbast = lkb->lkb_rqmode; |
1817 | } | 1817 | } |
@@ -1966,8 +1966,11 @@ static void confirm_master(struct dlm_rsb *r, int error) | |||
1966 | } | 1966 | } |
1967 | 1967 | ||
1968 | static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags, | 1968 | static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags, |
1969 | int namelen, unsigned long timeout_cs, void *ast, | 1969 | int namelen, unsigned long timeout_cs, |
1970 | void *astarg, void *bast, struct dlm_args *args) | 1970 | void (*ast) (void *astparam), |
1971 | void *astparam, | ||
1972 | void (*bast) (void *astparam, int mode), | ||
1973 | struct dlm_args *args) | ||
1971 | { | 1974 | { |
1972 | int rv = -EINVAL; | 1975 | int rv = -EINVAL; |
1973 | 1976 | ||
@@ -2017,9 +2020,9 @@ static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags, | |||
2017 | an active lkb cannot be modified before locking the rsb */ | 2020 | an active lkb cannot be modified before locking the rsb */ |
2018 | 2021 | ||
2019 | args->flags = flags; | 2022 | args->flags = flags; |
2020 | args->astaddr = ast; | 2023 | args->astfn = ast; |
2021 | args->astparam = (long) astarg; | 2024 | args->astparam = astparam; |
2022 | args->bastaddr = bast; | 2025 | args->bastfn = bast; |
2023 | args->timeout = timeout_cs; | 2026 | args->timeout = timeout_cs; |
2024 | args->mode = mode; | 2027 | args->mode = mode; |
2025 | args->lksb = lksb; | 2028 | args->lksb = lksb; |
@@ -2038,7 +2041,7 @@ static int set_unlock_args(uint32_t flags, void *astarg, struct dlm_args *args) | |||
2038 | return -EINVAL; | 2041 | return -EINVAL; |
2039 | 2042 | ||
2040 | args->flags = flags; | 2043 | args->flags = flags; |
2041 | args->astparam = (long) astarg; | 2044 | args->astparam = astarg; |
2042 | return 0; | 2045 | return 0; |
2043 | } | 2046 | } |
2044 | 2047 | ||
@@ -2068,9 +2071,9 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, | |||
2068 | 2071 | ||
2069 | lkb->lkb_exflags = args->flags; | 2072 | lkb->lkb_exflags = args->flags; |
2070 | lkb->lkb_sbflags = 0; | 2073 | lkb->lkb_sbflags = 0; |
2071 | lkb->lkb_astaddr = args->astaddr; | 2074 | lkb->lkb_astfn = args->astfn; |
2072 | lkb->lkb_astparam = args->astparam; | 2075 | lkb->lkb_astparam = args->astparam; |
2073 | lkb->lkb_bastaddr = args->bastaddr; | 2076 | lkb->lkb_bastfn = args->bastfn; |
2074 | lkb->lkb_rqmode = args->mode; | 2077 | lkb->lkb_rqmode = args->mode; |
2075 | lkb->lkb_lksb = args->lksb; | 2078 | lkb->lkb_lksb = args->lksb; |
2076 | lkb->lkb_lvbptr = args->lksb->sb_lvbptr; | 2079 | lkb->lkb_lvbptr = args->lksb->sb_lvbptr; |
@@ -2717,9 +2720,9 @@ static void send_args(struct dlm_rsb *r, struct dlm_lkb *lkb, | |||
2717 | /* m_result and m_bastmode are set from function args, | 2720 | /* m_result and m_bastmode are set from function args, |
2718 | not from lkb fields */ | 2721 | not from lkb fields */ |
2719 | 2722 | ||
2720 | if (lkb->lkb_bastaddr) | 2723 | if (lkb->lkb_bastfn) |
2721 | ms->m_asts |= AST_BAST; | 2724 | ms->m_asts |= AST_BAST; |
2722 | if (lkb->lkb_astaddr) | 2725 | if (lkb->lkb_astfn) |
2723 | ms->m_asts |= AST_COMP; | 2726 | ms->m_asts |= AST_COMP; |
2724 | 2727 | ||
2725 | /* compare with switch in create_message; send_remove() doesn't | 2728 | /* compare with switch in create_message; send_remove() doesn't |
@@ -3002,6 +3005,16 @@ static int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb, | |||
3002 | return 0; | 3005 | return 0; |
3003 | } | 3006 | } |
3004 | 3007 | ||
3008 | static void fake_bastfn(void *astparam, int mode) | ||
3009 | { | ||
3010 | log_print("fake_bastfn should not be called"); | ||
3011 | } | ||
3012 | |||
3013 | static void fake_astfn(void *astparam) | ||
3014 | { | ||
3015 | log_print("fake_astfn should not be called"); | ||
3016 | } | ||
3017 | |||
3005 | static int receive_request_args(struct dlm_ls *ls, struct dlm_lkb *lkb, | 3018 | static int receive_request_args(struct dlm_ls *ls, struct dlm_lkb *lkb, |
3006 | struct dlm_message *ms) | 3019 | struct dlm_message *ms) |
3007 | { | 3020 | { |
@@ -3010,8 +3023,9 @@ static int receive_request_args(struct dlm_ls *ls, struct dlm_lkb *lkb, | |||
3010 | lkb->lkb_remid = ms->m_lkid; | 3023 | lkb->lkb_remid = ms->m_lkid; |
3011 | lkb->lkb_grmode = DLM_LOCK_IV; | 3024 | lkb->lkb_grmode = DLM_LOCK_IV; |
3012 | lkb->lkb_rqmode = ms->m_rqmode; | 3025 | lkb->lkb_rqmode = ms->m_rqmode; |
3013 | lkb->lkb_bastaddr = (void *) (long) (ms->m_asts & AST_BAST); | 3026 | |
3014 | lkb->lkb_astaddr = (void *) (long) (ms->m_asts & AST_COMP); | 3027 | lkb->lkb_bastfn = (ms->m_asts & AST_BAST) ? &fake_bastfn : NULL; |
3028 | lkb->lkb_astfn = (ms->m_asts & AST_COMP) ? &fake_astfn : NULL; | ||
3015 | 3029 | ||
3016 | if (lkb->lkb_exflags & DLM_LKF_VALBLK) { | 3030 | if (lkb->lkb_exflags & DLM_LKF_VALBLK) { |
3017 | /* lkb was just created so there won't be an lvb yet */ | 3031 | /* lkb was just created so there won't be an lvb yet */ |
@@ -4291,8 +4305,8 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, | |||
4291 | lkb->lkb_grmode = rl->rl_grmode; | 4305 | lkb->lkb_grmode = rl->rl_grmode; |
4292 | /* don't set lkb_status because add_lkb wants to itself */ | 4306 | /* don't set lkb_status because add_lkb wants to itself */ |
4293 | 4307 | ||
4294 | lkb->lkb_bastaddr = (void *) (long) (rl->rl_asts & AST_BAST); | 4308 | lkb->lkb_bastfn = (rl->rl_asts & AST_BAST) ? &fake_bastfn : NULL; |
4295 | lkb->lkb_astaddr = (void *) (long) (rl->rl_asts & AST_COMP); | 4309 | lkb->lkb_astfn = (rl->rl_asts & AST_COMP) ? &fake_astfn : NULL; |
4296 | 4310 | ||
4297 | if (lkb->lkb_exflags & DLM_LKF_VALBLK) { | 4311 | if (lkb->lkb_exflags & DLM_LKF_VALBLK) { |
4298 | int lvblen = rc->rc_header.h_length - sizeof(struct dlm_rcom) - | 4312 | int lvblen = rc->rc_header.h_length - sizeof(struct dlm_rcom) - |
@@ -4466,7 +4480,7 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, | |||
4466 | lock and that lkb_astparam is the dlm_user_args structure. */ | 4480 | lock and that lkb_astparam is the dlm_user_args structure. */ |
4467 | 4481 | ||
4468 | error = set_lock_args(mode, &ua->lksb, flags, namelen, timeout_cs, | 4482 | error = set_lock_args(mode, &ua->lksb, flags, namelen, timeout_cs, |
4469 | DLM_FAKE_USER_AST, ua, DLM_FAKE_USER_AST, &args); | 4483 | fake_astfn, ua, fake_bastfn, &args); |
4470 | lkb->lkb_flags |= DLM_IFL_USER; | 4484 | lkb->lkb_flags |= DLM_IFL_USER; |
4471 | ua->old_mode = DLM_LOCK_IV; | 4485 | ua->old_mode = DLM_LOCK_IV; |
4472 | 4486 | ||
@@ -4540,7 +4554,7 @@ int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, | |||
4540 | ua->old_mode = lkb->lkb_grmode; | 4554 | ua->old_mode = lkb->lkb_grmode; |
4541 | 4555 | ||
4542 | error = set_lock_args(mode, &ua->lksb, flags, 0, timeout_cs, | 4556 | error = set_lock_args(mode, &ua->lksb, flags, 0, timeout_cs, |
4543 | DLM_FAKE_USER_AST, ua, DLM_FAKE_USER_AST, &args); | 4557 | fake_astfn, ua, fake_bastfn, &args); |
4544 | if (error) | 4558 | if (error) |
4545 | goto out_put; | 4559 | goto out_put; |
4546 | 4560 | ||