Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
pvfs2-osd/doc/add-server-req
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80 lines (61 sloc)
2.53 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps in adding a request to the server: | |
1) select a request name and number | |
src/proto/pvfs2-req-proto.h | |
2) add a request and response struct | |
src/proto/pvfs2-req-proto.h | |
add entry to unions: PVFS_server_req and PVFS_server_resp | |
2a) add endecode functions if needed | |
src/proto/endecode-funcs.h | |
for each of these you add or modify you must also | |
add a stub in include/pvfs2-encode-stubs.h | |
2b) update the protocol version number | |
src/proto/pvfs2-req-proto.h | |
increment PVFS2_PROTO_MINOR, assuming that the | |
addition of this new request does not break backwards | |
compatibility for other request types | |
3) add entries to decode/encode functions | |
src/proto/PINT-le-bytefield.c | |
lebf_initialize() - need code here to set up a request so it | |
can be encoded and expression for extra message size if any | |
lebf_encode_req() | |
lebf_encode_resp() | |
lebf_decode_req() | |
lebf_decode_resp() | |
lebf_decode_rel() (2 places) | |
In this last entry, we free any resources allocated during | |
decode - specifically array items | |
This does not free resources allocated by SM code | |
4) add request specific scratch space to PINT_server_op | |
src/server/pvfs2-server.h | |
PINT_server_op -- only if required | |
5) write state machine -- see details below | |
src/server/<reqname>.sm | |
each state machine added must have a delcaration in | |
src/server/pvfs2-server.h | |
6) update src/server/pvfs2-server-req.c | |
add new entry to PINT_server_req_table[] | |
reference the params structure from the state machine | |
Writing State Machines | |
Every state machine passes a PINT_server_op in to each state function. | |
state machine initialized in src/server/pvfs2-server.c | |
server_state_machine_start | |
gets the s_op set up | |
decodes request message | |
sets s_op->req, s_op->resp | |
Each state machine must first run the pvfs2_prelude_sm | |
reads the attribs of the target object, if appropriate to s_op->attr | |
does basic permission checking | |
posts request to the scheduler | |
State machines typically submit jobs, defined in | |
src/io/job/job.h | |
Each state machine must run the pvfs2_final_response_sm | |
releases request from the scheduler | |
sends response to the client | |
s_op->resp must be filled in | |
return status in js_p->error_code | |
Cleanup must free any memory allocated by SM code | |
State functions return 0 or 1 on error-free completion, | |
0 indicates an asynchronous call has been made and must be waited for | |
1 indicates no async call was made and should proceed to next state | |
<0 indicates an error - use PVFS_EXXX codes defined in | |
include/pvfs2-types.h | |