| 1 | /* |
|---|
| 2 | * (C) 2001 Clemson University and The University of Chicago |
|---|
| 3 | * |
|---|
| 4 | * See COPYING in top-level directory. |
|---|
| 5 | * |
|---|
| 6 | * Changes by Acxiom Corporation to add dirent_count field to attributes |
|---|
| 7 | * Copyright © Acxiom Corporation, 2005. |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | #include <string.h> |
|---|
| 11 | #include <assert.h> |
|---|
| 12 | |
|---|
| 13 | #include "server-config.h" |
|---|
| 14 | #include "pvfs2-server.h" |
|---|
| 15 | #include "pvfs2-attr.h" |
|---|
| 16 | #include "pvfs2-types.h" |
|---|
| 17 | #include "pvfs2-types-debug.h" |
|---|
| 18 | #include "pvfs2-util.h" |
|---|
| 19 | #include "pint-util.h" |
|---|
| 20 | #include "pvfs2-internal.h" |
|---|
| 21 | #include "pint-cached-config.h" |
|---|
| 22 | |
|---|
| 23 | %% |
|---|
| 24 | machine pvfs2_pjmp_get_attr_work_sm |
|---|
| 25 | { |
|---|
| 26 | state pjmp_get_attr_work_initialize |
|---|
| 27 | { |
|---|
| 28 | run pjmp_initialize; |
|---|
| 29 | default => pjmp_call_get_attr_work_sm; |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | state pjmp_call_get_attr_work_sm |
|---|
| 33 | { |
|---|
| 34 | jump pvfs2_get_attr_work_sm; |
|---|
| 35 | default => pjmp_get_attr_work_execute_terminate; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | state pjmp_get_attr_work_execute_terminate |
|---|
| 39 | { |
|---|
| 40 | run pjmp_execute_terminate; |
|---|
| 41 | default => terminate; |
|---|
| 42 | } |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | machine pvfs2_pjmp_create_immutable_copies_sm |
|---|
| 47 | { |
|---|
| 48 | state pjmp_create_immutable_copies_initialize |
|---|
| 49 | { |
|---|
| 50 | run pjmp_initialize; |
|---|
| 51 | default => pjmp_call_create_immutable_copies_sm; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | state pjmp_call_create_immutable_copies_sm |
|---|
| 55 | { |
|---|
| 56 | jump pvfs2_create_immutable_copies_sm; |
|---|
| 57 | default => pjmp_create_immutable_copies_execute_terminate; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | state pjmp_create_immutable_copies_execute_terminate |
|---|
| 61 | { |
|---|
| 62 | run pjmp_execute_terminate; |
|---|
| 63 | default => terminate; |
|---|
| 64 | } |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | machine pvfs2_pjmp_mirror_work_sm |
|---|
| 69 | { |
|---|
| 70 | state pjmp_mirror_work_initialize |
|---|
| 71 | { |
|---|
| 72 | run pjmp_initialize; |
|---|
| 73 | default => pjmp_call_mirror_work_sm; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | state pjmp_call_mirror_work_sm |
|---|
| 77 | { |
|---|
| 78 | jump pvfs2_mirror_work_sm; |
|---|
| 79 | default => pjmp_mirror_work_execute_terminate; |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | state pjmp_mirror_work_execute_terminate |
|---|
| 83 | { |
|---|
| 84 | run pjmp_execute_terminate; |
|---|
| 85 | default => terminate; |
|---|
| 86 | } |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | machine pvfs2_pjmp_remove_work_sm |
|---|
| 91 | { |
|---|
| 92 | state pjmp_remove_work_initialize |
|---|
| 93 | { |
|---|
| 94 | run pjmp_initialize; |
|---|
| 95 | default => pjmp_call_remove_work_sm; |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | state pjmp_call_remove_work_sm |
|---|
| 99 | { |
|---|
| 100 | jump pvfs2_remove_work_sm; |
|---|
| 101 | default => pjmp_remove_work_execute_terminate; |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | state pjmp_remove_work_execute_terminate |
|---|
| 105 | { |
|---|
| 106 | run pjmp_execute_terminate; |
|---|
| 107 | default => terminate; |
|---|
| 108 | } |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | machine pvfs2_pjmp_get_attr_with_prelude_sm |
|---|
| 113 | { |
|---|
| 114 | state pjmp_initialize |
|---|
| 115 | { |
|---|
| 116 | run pjmp_initialize; |
|---|
| 117 | default => pjmp_call_get_attr_with_prelude; |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | state pjmp_call_get_attr_with_prelude |
|---|
| 121 | { |
|---|
| 122 | jump pvfs2_get_attr_with_prelude_sm; |
|---|
| 123 | default => pjmp_execute_terminate; |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | state pjmp_execute_terminate |
|---|
| 127 | { |
|---|
| 128 | run pjmp_execute_terminate; |
|---|
| 129 | default => terminate; |
|---|
| 130 | } |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | machine pvfs2_pjmp_call_msgpairarray_sm |
|---|
| 135 | { |
|---|
| 136 | state call_msgpairarray |
|---|
| 137 | { |
|---|
| 138 | run call_msgpairarray; |
|---|
| 139 | success => transfer_msgpair; |
|---|
| 140 | default => cleanup_msgpairarray; |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | state transfer_msgpair |
|---|
| 144 | { |
|---|
| 145 | jump pvfs2_msgpairarray_sm; |
|---|
| 146 | default => cleanup_msgpairarray; |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | state cleanup_msgpairarray |
|---|
| 150 | { |
|---|
| 151 | run cleanup_msgpairarray; |
|---|
| 152 | default => terminate; |
|---|
| 153 | } |
|---|
| 154 | } /*end state machine pvfs2_pjmp_call_msgpairarray_sm*/ |
|---|
| 155 | %% |
|---|
| 156 | |
|---|
| 157 | static PINT_sm_action pjmp_initialize( struct PINT_smcb *smcb |
|---|
| 158 | , job_status_s *js_p) |
|---|
| 159 | { |
|---|
| 160 | js_p->error_code = 0; |
|---|
| 161 | return SM_ACTION_COMPLETE; |
|---|
| 162 | } |
|---|
| 163 | |
|---|
| 164 | static PINT_sm_action pjmp_execute_terminate( struct PINT_smcb *smcb |
|---|
| 165 | , job_status_s *js_p) |
|---|
| 166 | { |
|---|
| 167 | return SM_ACTION_TERMINATE; |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | /****************************************************************************/ |
|---|
| 171 | /* Actions for pvfs2_pjmp_call_msgpairarray_sm */ |
|---|
| 172 | /****************************************************************************/ |
|---|
| 173 | |
|---|
| 174 | /*We use a separate nested state machine to call msgpairarray because */ |
|---|
| 175 | /*msgpairarray.sm is setup to work only with a "jump". When "pjmp" */ |
|---|
| 176 | /*is used, the frame stack gets corrupted. */ |
|---|
| 177 | static PINT_sm_action call_msgpairarray (struct PINT_smcb *smcb |
|---|
| 178 | ,job_status_s *js_p) |
|---|
| 179 | { |
|---|
| 180 | gossip_debug(GOSSIP_SERVER_DEBUG,"Executing pvfs2_pjmp_call_msgpairarray_sm:" |
|---|
| 181 | "call_msgpairarray for operation (%s)\n" |
|---|
| 182 | ,PINT_map_server_op_to_string(smcb->op)); |
|---|
| 183 | gossip_debug(GOSSIP_MIRROR_DEBUG,"Executing pvfs2_pjmp_call_msgpairarray_sm:" |
|---|
| 184 | "call_msgpairarray for operation (%s)\n" |
|---|
| 185 | ,PINT_map_server_op_to_string(smcb->op)); |
|---|
| 186 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\tframe count is %d.\n",smcb->frame_count); |
|---|
| 187 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\t base frame is %d.\n",smcb->base_frame); |
|---|
| 188 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\t op nbr is #%d.\n",smcb->op); |
|---|
| 189 | |
|---|
| 190 | struct PINT_server_op *s_op = PINT_sm_frame(smcb,PINT_FRAME_CURRENT); |
|---|
| 191 | PINT_sm_msgarray_op *msgarray = &(s_op->msgarray_op); |
|---|
| 192 | |
|---|
| 193 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\ts_op:%p\n",s_op); |
|---|
| 194 | |
|---|
| 195 | js_p->error_code = 0; |
|---|
| 196 | |
|---|
| 197 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\tmsgarray->msgpair.req.op:%d\n" |
|---|
| 198 | ,msgarray->msgpair.req.op ); |
|---|
| 199 | |
|---|
| 200 | PINT_sm_push_frame(smcb,0,msgarray); |
|---|
| 201 | |
|---|
| 202 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\tAFTER PUSH:smcb->base_frame:%d" |
|---|
| 203 | "\tframe_count:%d\n" |
|---|
| 204 | ,smcb->base_frame,smcb->frame_count); |
|---|
| 205 | |
|---|
| 206 | return SM_ACTION_COMPLETE; |
|---|
| 207 | }/*end action call_msgpairarray*/ |
|---|
| 208 | |
|---|
| 209 | static PINT_sm_action cleanup_msgpairarray (struct PINT_smcb *smcb |
|---|
| 210 | ,job_status_s *js_p) |
|---|
| 211 | { |
|---|
| 212 | gossip_debug(GOSSIP_MIRROR_DEBUG,"Executing pvfs2_pjmp_call_msgpairarray_sm:cleanup_msgpairarray" |
|---|
| 213 | "....\n"); |
|---|
| 214 | struct PINT_server_op *s_op = PINT_sm_frame(smcb,PINT_FRAME_CURRENT); |
|---|
| 215 | PINT_sm_msgarray_op *msgarray = &(s_op->msgarray_op); |
|---|
| 216 | |
|---|
| 217 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\ts_op:%p\n",s_op); |
|---|
| 218 | |
|---|
| 219 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\tjs_p->error_code:%d\n" |
|---|
| 220 | ,js_p->error_code); |
|---|
| 221 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\tBEFORE POP:smcb->frame_base:%d" |
|---|
| 222 | "\tframe_count:%d\n" |
|---|
| 223 | ,smcb->base_frame,smcb->frame_count); |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\tmsgarray->msgpair.req.op:%d\n" |
|---|
| 227 | ,msgarray->msgpair.req.op ); |
|---|
| 228 | |
|---|
| 229 | gossip_debug(GOSSIP_MIRROR_DEBUG,"\ts_op->resp.status:%d\n" |
|---|
| 230 | ,s_op->resp.status); |
|---|
| 231 | |
|---|
| 232 | return SM_ACTION_TERMINATE; |
|---|
| 233 | }/*end action cleanup_msgpairarray*/ |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | /* |
|---|
| 237 | * Local variables: |
|---|
| 238 | * mode: c |
|---|
| 239 | * c-indent-level: 4 |
|---|
| 240 | * c-basic-offset: 4 |
|---|
| 241 | * End: |
|---|
| 242 | * |
|---|
| 243 | * vim: ft=c ts=8 sts=4 sw=4 expandtab |
|---|
| 244 | */ |
|---|