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 | |
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')
-rw-r--r-- | fs/dlm/ast.c | 9 | ||||
-rw-r--r-- | fs/dlm/dlm_internal.h | 14 | ||||
-rw-r--r-- | fs/dlm/lock.c | 50 | ||||
-rw-r--r-- | fs/dlm/rcom.c | 4 |
4 files changed, 44 insertions, 33 deletions
diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index 6308122890ca..8bf31e3fbf01 100644 --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c | |||
@@ -39,7 +39,6 @@ void dlm_add_ast(struct dlm_lkb *lkb, int type) | |||
39 | dlm_user_add_ast(lkb, type); | 39 | dlm_user_add_ast(lkb, type); |
40 | return; | 40 | return; |
41 | } | 41 | } |
42 | DLM_ASSERT(lkb->lkb_astaddr != DLM_FAKE_USER_AST, dlm_print_lkb(lkb);); | ||
43 | 42 | ||
44 | spin_lock(&ast_queue_lock); | 43 | spin_lock(&ast_queue_lock); |
45 | if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) { | 44 | if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) { |
@@ -58,8 +57,8 @@ static void process_asts(void) | |||
58 | struct dlm_ls *ls = NULL; | 57 | struct dlm_ls *ls = NULL; |
59 | struct dlm_rsb *r = NULL; | 58 | struct dlm_rsb *r = NULL; |
60 | struct dlm_lkb *lkb; | 59 | struct dlm_lkb *lkb; |
61 | void (*cast) (long param); | 60 | void (*cast) (void *astparam); |
62 | void (*bast) (long param, int mode); | 61 | void (*bast) (void *astparam, int mode); |
63 | int type = 0, found, bmode; | 62 | int type = 0, found, bmode; |
64 | 63 | ||
65 | for (;;) { | 64 | for (;;) { |
@@ -83,8 +82,8 @@ static void process_asts(void) | |||
83 | if (!found) | 82 | if (!found) |
84 | break; | 83 | break; |
85 | 84 | ||
86 | cast = lkb->lkb_astaddr; | 85 | cast = lkb->lkb_astfn; |
87 | bast = lkb->lkb_bastaddr; | 86 | bast = lkb->lkb_bastfn; |
88 | bmode = lkb->lkb_bastmode; | 87 | bmode = lkb->lkb_bastmode; |
89 | 88 | ||
90 | if ((type & AST_COMP) && cast) | 89 | if ((type & AST_COMP) && cast) |
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index f7fbaec94b15..a53c237f310c 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
@@ -92,8 +92,6 @@ do { \ | |||
92 | } \ | 92 | } \ |
93 | } | 93 | } |
94 | 94 | ||
95 | #define DLM_FAKE_USER_AST ERR_PTR(-EINVAL) | ||
96 | |||
97 | 95 | ||
98 | struct dlm_direntry { | 96 | struct dlm_direntry { |
99 | struct list_head list; | 97 | struct list_head list; |
@@ -146,9 +144,9 @@ struct dlm_recover { | |||
146 | 144 | ||
147 | struct dlm_args { | 145 | struct dlm_args { |
148 | uint32_t flags; | 146 | uint32_t flags; |
149 | void *astaddr; | 147 | void (*astfn) (void *astparam); |
150 | long astparam; | 148 | void *astparam; |
151 | void *bastaddr; | 149 | void (*bastfn) (void *astparam, int mode); |
152 | int mode; | 150 | int mode; |
153 | struct dlm_lksb *lksb; | 151 | struct dlm_lksb *lksb; |
154 | unsigned long timeout; | 152 | unsigned long timeout; |
@@ -253,9 +251,9 @@ struct dlm_lkb { | |||
253 | 251 | ||
254 | char *lkb_lvbptr; | 252 | char *lkb_lvbptr; |
255 | struct dlm_lksb *lkb_lksb; /* caller's status block */ | 253 | struct dlm_lksb *lkb_lksb; /* caller's status block */ |
256 | void *lkb_astaddr; /* caller's ast function */ | 254 | void (*lkb_astfn) (void *astparam); |
257 | void *lkb_bastaddr; /* caller's bast function */ | 255 | void (*lkb_bastfn) (void *astparam, int mode); |
258 | long lkb_astparam; /* caller's ast arg */ | 256 | void *lkb_astparam; /* caller's ast arg */ |
259 | }; | 257 | }; |
260 | 258 | ||
261 | 259 | ||
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 | ||
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c index ef9d0f918492..035e6f9990b0 100644 --- a/fs/dlm/rcom.c +++ b/fs/dlm/rcom.c | |||
@@ -318,9 +318,9 @@ static void pack_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb, | |||
318 | rl->rl_status = lkb->lkb_status; | 318 | rl->rl_status = lkb->lkb_status; |
319 | rl->rl_wait_type = cpu_to_le16(lkb->lkb_wait_type); | 319 | rl->rl_wait_type = cpu_to_le16(lkb->lkb_wait_type); |
320 | 320 | ||
321 | if (lkb->lkb_bastaddr) | 321 | if (lkb->lkb_bastfn) |
322 | rl->rl_asts |= AST_BAST; | 322 | rl->rl_asts |= AST_BAST; |
323 | if (lkb->lkb_astaddr) | 323 | if (lkb->lkb_astfn) |
324 | rl->rl_asts |= AST_COMP; | 324 | rl->rl_asts |= AST_COMP; |
325 | 325 | ||
326 | rl->rl_namelen = cpu_to_le16(r->res_length); | 326 | rl->rl_namelen = cpu_to_le16(r->res_length); |