root/branches/Orange-Branch/src/server/pvfs2-server.h @ 8666

Revision 8666, 24.6 KB (checked in by mtmoore, 2 years ago)

change PINT_server_op variable used by tree_communicate to use a more descriptive name

Line 
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7/*
8 *  Declarations for use in the PVFS2 server.
9 */
10
11#ifndef __PVFS2_SERVER_H
12#define __PVFS2_SERVER_H
13
14/* NOTE: STATE-MACHINE.H IS INCLUDED AT THE BOTTOM!  THIS IS SO WE CAN
15 * DEFINE ALL THE STRUCTURES WE NEED BEFORE WE INCLUDE IT.
16 */
17
18#include <stdint.h>
19#include <sys/types.h>
20#include <pwd.h>
21#include <grp.h>
22#include <string.h>
23#include "pvfs2-debug.h"
24#include "pvfs2-storage.h"
25#include "pvfs2-internal.h"
26#include "job.h"
27#include "bmi.h"
28#include "trove.h"
29#include "gossip.h"
30#include "PINT-reqproto-encode.h"
31#include "msgpairarray.h"
32#include "pvfs2-req-proto.h"
33#include "pvfs2-mirror.h"
34#include "state-machine.h"
35#include "pint-event.h"
36
37
38extern job_context_id server_job_context;
39
40#define PVFS2_SERVER_DEFAULT_TIMEOUT_MS      100
41#define BMI_UNEXPECTED_OP                    999
42
43/* BMI operation timeout if not specified in config file */
44#define PVFS2_SERVER_JOB_BMI_TIMEOUT_DEFAULT         30
45/* Flow operation timeout if not specified in config file */
46#define PVFS2_SERVER_JOB_FLOW_TIMEOUT_DEFAULT        30
47/* BMI client side operation timeout if not specified in config file */
48/* NOTE: the default for this timeout is set higher to allow the client to
49 * overcome syncing and queueing delays on the server
50 */
51#define PVFS2_CLIENT_JOB_BMI_TIMEOUT_DEFAULT         300
52/* Flow client side operation timeout if not specified in config file */
53#define PVFS2_CLIENT_JOB_FLOW_TIMEOUT_DEFAULT        300
54/* maximum number of times for client to retry restartable operations;
55 * use INT_MAX to approximate infinity (187 years with 2 sec delay)
56 */
57#define PVFS2_CLIENT_RETRY_LIMIT_DEFAULT     (5)
58/* number of milliseconds that clients will delay between retries */
59#define PVFS2_CLIENT_RETRY_DELAY_MS_DEFAULT  2000
60
61/* Specifies the number of handles to be preceated at a time from each
62 * server using the batch create request.
63 */
64#define PVFS2_PRECREATE_BATCH_SIZE_DEFAULT 512
65/* precreate pools will be topped off if they fall below this value */
66#define PVFS2_PRECREATE_LOW_THRESHOLD_DEFAULT 256
67
68/* types of permission checking that a server may need to perform for
69 * incoming requests
70 */
71enum PINT_server_req_permissions
72{
73    PINT_SERVER_CHECK_INVALID = 0, /* invalid request */
74    PINT_SERVER_CHECK_WRITE = 1,   /* needs write permission */
75    PINT_SERVER_CHECK_READ = 2,    /* needs read permission */
76    PINT_SERVER_CHECK_NONE = 3,    /* needs no permission */
77    PINT_SERVER_CHECK_ATTR = 4,    /* special case for attribute operations;
78                                      needs ownership */
79    PINT_SERVER_CHECK_CRDIRENT = 5 /* special case for crdirent operations;
80                                      needs write and execute */
81};
82
83#define PINT_GET_OBJECT_REF_DEFINE(req_name)                             \
84static inline int PINT_get_object_ref_##req_name(                        \
85    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle) \
86{                                                                        \
87    *fs_id = req->u.req_name.fs_id;                                      \
88    *handle = req->u.req_name.handle;                                    \
89    return 0;                                                            \
90}
91
92enum PINT_server_req_access_type PINT_server_req_readonly(
93                                    struct PVFS_server_req *req);
94enum PINT_server_req_access_type PINT_server_req_modify(
95                                    struct PVFS_server_req *req);
96
97struct PINT_server_req_params
98{
99    const char* string_name;
100
101    /* For each request that specifies an object ref (fsid,handle) we
102     * get the common attributes on that object and check the permissions.
103     * For the request to proceed the permissions required by this flag
104     * must be met.
105     */
106    enum PINT_server_req_permissions perm;
107
108    /* Specifies the type of access on the object (readonly, modify).  This
109     * is used by the request scheduler to determine
110     * which requests to queue (block), and which to schedule (proceed).
111     * This is a callback implemented by the request.  For example, sometimes
112     * the io request writes, sometimes it reads.
113     * Default functions PINT_server_req_readonly and PINT_server_req_modify
114     * are used for requests that always require the same access type.
115     */
116    enum PINT_server_req_access_type (*access_type)(
117                                        struct PVFS_server_req *req);
118
119    /* Specifies the scheduling policy for the request.  In some cases,
120     * we can bypass the request scheduler and proceed directly with the
121     * request.
122     */
123    enum PINT_server_sched_policy sched_policy;
124
125    /* A callback implemented by the request to return the object reference
126     * from the server request structure.
127     */
128    int (*get_object_ref)(
129        struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle);
130
131    /* The state machine that performs the request */
132    struct PINT_state_machine_s *state_machine;
133};
134
135struct PINT_server_req_entry
136{
137    enum PVFS_server_op op_type;
138    struct PINT_server_req_params *params;
139};
140
141extern struct PINT_server_req_entry PINT_server_req_table[];
142
143int PINT_server_req_get_object_ref(
144    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle);
145
146enum PINT_server_req_permissions
147PINT_server_req_get_perms(struct PVFS_server_req *req);
148enum PINT_server_req_access_type
149PINT_server_req_get_access_type(struct PVFS_server_req *req);
150enum PINT_server_sched_policy
151PINT_server_req_get_sched_policy(struct PVFS_server_req *req);
152
153const char* PINT_map_server_op_to_string(enum PVFS_server_op op);
154
155/* used to keep a random, but handy, list of keys around */
156typedef struct PINT_server_trove_keys
157{
158    char *key;
159    int size;
160} PINT_server_trove_keys_s;
161
162extern PINT_server_trove_keys_s Trove_Common_Keys[];
163/* Reserved keys */
164enum
165{
166    ROOT_HANDLE_KEY      = 0,
167    DIR_ENT_KEY          = 1,
168    METAFILE_HANDLES_KEY = 2,
169    METAFILE_DIST_KEY    = 3,
170    SYMLINK_TARGET_KEY   = 4,
171    METAFILE_LAYOUT_KEY  = 5,
172    NUM_DFILES_REQ_KEY   = 6
173};
174
175/* optional; user-settable keys */
176enum
177{
178    DIST_NAME_KEY        = 0,
179    DIST_PARAMS_KEY      = 1,
180    NUM_DFILES_KEY       = 2,
181    NUM_SPECIAL_KEYS     = 3, /* not an index */
182    METAFILE_HINT_KEY    = 3,
183    MIRROR_COPIES_KEY    = 4,
184    MIRROR_HANDLES_KEY   = 5,
185    MIRROR_STATUS_KEY    = 6,
186};
187
188typedef enum
189{
190    SERVER_DEFAULT_INIT        = 0,
191    SERVER_GOSSIP_INIT         = (1 << 0),
192    SERVER_CONFIG_INIT         = (1 << 1),
193    SERVER_ENCODER_INIT        = (1 << 2),
194    SERVER_BMI_INIT            = (1 << 3),
195    SERVER_TROVE_INIT          = (1 << 4),
196    SERVER_FLOW_INIT           = (1 << 5),
197    SERVER_JOB_INIT            = (1 << 6),
198    SERVER_JOB_CTX_INIT        = (1 << 7),
199    SERVER_REQ_SCHED_INIT      = (1 << 8),
200    SERVER_STATE_MACHINE_INIT  = (1 << 9),
201    SERVER_BMI_UNEXP_POST_INIT = (1 << 10),
202    SERVER_SIGNAL_HANDLER_INIT = (1 << 11),
203    SERVER_JOB_OBJS_ALLOCATED  = (1 << 12),
204    SERVER_PERF_COUNTER_INIT   = (1 << 13),
205    SERVER_EVENT_INIT          = (1 << 14),
206    SERVER_JOB_TIME_MGR_INIT   = (1 << 15),
207    SERVER_DIST_INIT           = (1 << 16),
208    SERVER_CACHED_CONFIG_INIT  = (1 << 17),
209    SERVER_PRECREATE_INIT  = (1 << 18),
210} PINT_server_status_flag;
211
212typedef enum
213{   
214    PRELUDE_SCHEDULER_DONE     = (1 << 0),
215    PRELUDE_GETATTR_DONE       = (1 << 1),
216    PRELUDE_PERM_CHECK_DONE    = (1 << 2),
217    PRELUDE_LOCAL_CALL         = (1 << 3),
218} PINT_prelude_flag;
219
220struct PINT_server_create_op
221{
222    const char **io_servers;
223    const char **remote_io_servers;
224    int num_io_servers;
225    PVFS_handle* handle_array_local;
226    PVFS_handle* handle_array_remote;
227    int handle_array_local_count;
228    int handle_array_remote_count;
229    PVFS_error saved_error_code;
230    int handle_index;
231};
232
233/*MIRROR structures*/
234typedef struct
235{
236   /* session identifier created in the PVFS_SERV_IO request.  also used as  */
237   /* the flow identifier.                                                   */
238   bmi_msg_tag_t session_tag;
239
240   /*destination server address*/
241   PVFS_BMI_addr_t svr_addr;
242
243   /*status from PVFS_SERV_IO*/
244   PVFS_error io_status;
245
246   /*variables used to setup write completion ack*/
247   void        *encoded_resp_p;
248   job_status_s recv_status;
249   job_id_t     recv_id;
250
251   /*variables used to setup flow between the src & dest datahandle*/
252   flow_descriptor *flow_desc;
253   job_status_s     flow_status;
254   job_id_t         flow_job_id;
255 
256} write_job_t;
257
258
259/*This structure is used during the processing of a "mirror" request.*/
260struct PINT_server_mirror_op
261{
262   /*keep up with the number of outstanding jobs*/
263   int job_count;
264
265   /*maximum response size for the write request*/
266   int max_resp_sz;
267
268   /*info about each job*/
269   write_job_t *jobs;
270};
271typedef struct PINT_server_mirror_op PINT_server_mirror_op;
272
273/* Source refers to the handle being copied, and destination refers to        */
274/* its copy.                                                                  */
275struct PINT_server_create_copies_op
276{
277    /*number of I/O servers required to meet the mirroring request.           */
278    uint32_t io_servers_required;
279
280    /*mirroring mode. attribute key is user.pvfs2.mirror.mode*/
281    MIRROR_MODE mirror_mode;
282
283    /*the expected mirroring mode tells us how to edit the retrieved mirroring*/
284    /*mode.  Example: if mirroring was called when immutable was set, then    */
285    /*the expected mirroring mode would be MIRROR_ON_IMMUTABLE.               */
286    MIRROR_MODE expected_mirror_mode;
287
288    /*buffer holding list of remote servers for all copies of the file*/
289    char **my_remote_servers;
290
291    /*saved error code*/
292    PVFS_error saved_error_code;
293
294    /*number of copies desired. value of user.pvfs2.mirror.copies attribute*/
295    uint32_t copies;
296
297    /*successful/failed writes array in order of source handles         */
298    /*0=>successful  !UINT64_HIGH=>failure   UINT64_HIGH=>initial state */
299    /*accessed as if a 2-dimensional array [SrcHandleNR][#ofCopies]     */
300    PVFS_handle *writes_completed;
301
302    /*number of attempts at writing handles*/
303    int retry_count;
304
305    /*list of server names that will be used as destination servers*/
306    char **io_servers;                       
307
308    /*source remote server names in distribution*/
309    char **remote_io_servers;
310
311    /*source local server names in distribution*/;               
312    char **local_io_servers;
313
314    /*number of source server names in the distribution*/                     
315    int num_io_servers;
316
317    /*number of source remote server names in distribution*/                 
318    int remote_io_servers_count;             
319
320    /*number of source local server names in distribution*/
321    int local_io_servers_count;             
322
323    /*source datahandles in order of distribution*/
324    PVFS_handle *handle_array_base;
325
326    /*local source datahandles*/
327    PVFS_handle *handle_array_base_local;
328
329    /*destination datahandles in order of distribution*/         
330    PVFS_handle *handle_array_copies;       
331
332    /*local destination datahandles*/
333    PVFS_handle *handle_array_copies_local; 
334
335    /*remote destination datahandles*/
336    PVFS_handle *handle_array_copies_remote;
337
338    /*number of local source datahandles*/
339    int handle_array_base_local_count;
340
341    /*number of local destination datahandles*/
342    int handle_array_copies_local_count;     
343
344    /*number of remote destination datahandles*/
345    int handle_array_copies_remote_count;     
346
347    /*number of source datahandles*/
348    uint32_t dfile_count;
349
350    /*source metadata handle*/                     
351    PVFS_handle metadata_handle;
352
353    /*source file system*/
354    PVFS_fs_id fs_id;
355
356    /*number of io servers defined in the current file system*/
357    int io_servers_count;
358
359    /*size of the source distribution structure */
360    uint32_t dist_size;
361
362    /*distribution structure for basic_dist*/
363    PINT_dist *dist;
364
365    /*local source handles' attribute structure*/
366    /*populates bstream_array_base_local with byte stream size*/
367    PVFS_ds_attributes *ds_attr_a;
368
369    /*local source handles' byte stream size*/
370    /*index corresponds to handle_array_base*/
371    PVFS_size *bstream_array_base_local;
372};
373typedef struct PINT_server_create_copies_op PINT_server_create_copies_op;
374
375
376/*This macro is used to initialize a PINT_server_op structure when pjmp'ing */
377/*to pvfs2_create_immutable_copies_sm.                                      */
378#define PVFS_SERVOP_IMM_COPIES_FILL(__new_p,__cur_p)                           \
379do {                                                                           \
380   memcpy(__new_p,__cur_p,sizeof(struct PINT_server_op));                      \
381   (__new_p)->op = PVFS_SERV_IMM_COPIES;                                       \
382   memset(&((__new_p)->u.create_copies),0,sizeof((__new_p)->u.create_copies)); \
383}while(0)
384
385
386
387/* struct PINT_server_lookup_op
388 *
389 * All the data needed during lookup processing:
390 *
391 */
392struct PINT_server_lookup_op
393{
394    /* current segment (0..N), number of segments in the path */
395    int seg_ct, seg_nr;
396
397    /* number of attrs read succesfully */
398    int attr_ct;
399
400    /* number of handles read successfully */
401    int handle_ct;
402
403    char *segp;
404    void *segstate;
405
406    PVFS_handle dirent_handle;
407    PVFS_ds_attributes *ds_attr_array;
408};
409
410struct PINT_server_readdir_op
411{
412    uint64_t directory_version;
413    PVFS_handle dirent_handle;  /* holds handle of dirdata dspace from
414                                   which entries are read */
415    PVFS_size dirdata_size;
416};
417
418struct PINT_server_crdirent_op
419{
420    char *name;
421    PVFS_handle new_handle;
422    PVFS_handle parent_handle;
423    PVFS_fs_id fs_id;
424    PVFS_handle dirent_handle;  /* holds handle of dirdata dspace that
425                                 * we'll write the dirent into */
426    PVFS_size dirent_count;
427    int dir_attr_update_required;
428};
429
430struct PINT_server_rmdirent_op
431{
432    PVFS_handle dirdata_handle;
433    PVFS_handle entry_handle; /* holds handle of dirdata object,
434                               * removed entry */
435    PVFS_size dirent_count;
436    int dir_attr_update_required;
437};
438
439struct PINT_server_chdirent_op
440{
441    PVFS_handle dirdata_handle;
442    PVFS_handle old_dirent_handle;
443    PVFS_handle new_dirent_handle;
444    int dir_attr_update_required;
445};
446
447struct PINT_server_remove_op
448{
449    PVFS_handle handle;
450    PVFS_fs_id fs_id;
451    PVFS_handle dirdata_handle;   /* holds dirdata dspace handle in
452                                   * the event that we are removing a
453                                   * directory */
454    PVFS_size dirent_count;
455    PVFS_ds_keyval key;
456    PVFS_ds_position pos;
457    int key_count;
458    int index;
459    int remove_keyvals_state;
460};
461
462struct PINT_server_mgmt_remove_dirent_op
463{
464    PVFS_handle dirdata_handle;
465};
466
467struct PINT_server_precreate_pool_refiller_op
468{
469    PVFS_handle pool_handle;
470    PVFS_handle* precreate_handle_array;
471    PVFS_fs_id fsid;
472    char* host;
473    PVFS_BMI_addr_t host_addr;
474    PVFS_handle_extent_array handle_extent_array;
475    PVFS_ds_type type;
476};
477
478struct PINT_server_batch_create_op
479{
480    int saved_error_code;
481    int batch_index;
482};
483
484struct PINT_server_batch_remove_op
485{
486    int handle_index;
487    int error_code;
488};
489
490struct PINT_server_mgmt_get_dirdata_op
491{
492    PVFS_handle dirdata_handle;
493};
494
495struct PINT_server_getconfig_op
496{
497    int strsize; /* used to hold string lengths during getconfig
498                  * processing */
499};
500
501struct PINT_server_io_op
502{
503    flow_descriptor* flow_d;
504};
505
506struct PINT_server_small_io_op
507{
508    PVFS_offset offsets[IO_MAX_REGIONS];
509    PVFS_size sizes[IO_MAX_REGIONS];
510    PVFS_size result_bytes;
511};
512
513struct PINT_server_flush_op
514{
515    PVFS_handle handle;     /* handle of data we want to flush to disk */
516    int flags;              /* any special flags for flush */
517};
518
519struct PINT_server_truncate_op
520{
521    PVFS_handle handle;     /* handle of datafile we resize */
522    PVFS_offset size;       /* new size of datafile */
523};
524
525struct PINT_server_mkdir_op
526{
527    PVFS_fs_id fs_id;
528    PVFS_handle_extent_array handle_extent_array;
529    PVFS_handle dirent_handle;
530    PVFS_size init_dirdata_size;
531};
532
533struct PINT_server_getattr_op
534{
535    PVFS_handle handle;
536    PVFS_fs_id fs_id;
537    PVFS_ds_attributes dirdata_ds_attr;
538    uint32_t attrmask;
539    PVFS_error* err_array;
540    PVFS_ds_keyval_handle_info keyval_handle_info;
541    PVFS_handle dirent_handle;
542    int num_dfiles_req;
543    PVFS_handle *mirror_dfile_status_array;
544};
545
546struct PINT_server_listattr_op
547{
548    PVFS_object_attr *attr_a;
549    PVFS_ds_attributes *ds_attr_a;
550    PVFS_error *errors;
551    int parallel_sms;
552};
553
554/* this is used in both set_eattr, get_eattr and list_eattr */
555struct PINT_server_eattr_op
556{
557    void *buffer;
558};
559
560struct PINT_server_unstuff_op
561{
562    PVFS_handle* dfile_array;
563    int num_dfiles_req;
564    PVFS_sys_layout layout;
565    void* encoded_layout;
566};
567
568struct PINT_server_tree_communicate_op
569{
570    int num_partitions;
571    PVFS_handle* handle_array_local;
572    PVFS_handle* handle_array_remote;
573    uint32_t *local_join_size;
574    uint32_t *remote_join_size;
575    int handle_array_local_count;
576    int handle_array_remote_count;
577    int handle_index;
578};
579
580/* This structure is passed into the void *ptr
581 * within the job interface.  Used to tell us where
582 * to go next in our state machine.
583 */
584typedef struct PINT_server_op
585{
586    struct qlist_head   next; /* used to queue structures used for unexp style messages */
587    int op_cancelled; /* indicates unexp message was cancelled */
588    job_id_t unexp_id;
589
590    enum PVFS_server_op op;  /* type of operation that we are servicing */
591
592    PINT_event_id event_id;
593
594    /* holds id from request scheduler so we can release it later */
595    job_id_t scheduled_id;
596
597    /* generic structures used in most server operations */
598    PVFS_ds_keyval key, val;
599    PVFS_ds_keyval *key_a;
600    PVFS_ds_keyval *val_a;
601    int *error_a;
602    int keyval_count;
603
604    int free_val;
605
606    /* generic int for use by state machines that are accessing
607     * PINT_server_op structs before pjumping to them. */
608    int local_index;
609
610    /* attributes structure associated with target of operation; may be
611     * partially filled in by prelude nested state machine (for
612     * permission checking); may be used/modified by later states as well
613     *
614     * the ds_attr is used by the prelude sm only (and for pulling the
615     * size out in the get-attr server sm); don't use it otherwise --
616     * the object_attr is prepared for other sm's, so use it instead.
617     */
618    PVFS_ds_attributes ds_attr;
619    PVFS_object_attr attr;
620
621    PVFS_BMI_addr_t addr;   /* address of client that contacted us */
622    bmi_msg_tag_t tag; /* operation tag */
623    /* information about unexpected message that initiated this operation */
624    struct BMI_unexpected_info unexp_bmi_buff;
625
626    /* decoded request and response structures */
627    struct PVFS_server_req *req;
628    struct PVFS_server_resp resp;
629    /* encoded request and response structures */
630    struct PINT_encoded_msg encoded;
631    struct PINT_decoded_msg decoded;
632
633    PINT_sm_msgarray_op msgarray_op;
634
635    PVFS_handle target_handle;
636    PVFS_fs_id target_fs_id;
637    PVFS_object_attr *target_object_attr;
638
639    PINT_prelude_flag prelude_mask;
640
641    enum PINT_server_req_access_type access_type;
642    enum PINT_server_sched_policy sched_policy;
643
644    int num_pjmp_frames;
645
646    union
647    {
648        /* request-specific scratch spaces for use during processing */
649        struct PINT_server_create_op create;
650        struct PINT_server_eattr_op eattr;
651        struct PINT_server_getattr_op getattr;
652        struct PINT_server_listattr_op listattr;
653        struct PINT_server_getconfig_op getconfig;
654        struct PINT_server_lookup_op lookup;
655        struct PINT_server_crdirent_op crdirent;
656        struct PINT_server_readdir_op readdir;
657        struct PINT_server_remove_op remove;
658        struct PINT_server_chdirent_op chdirent;
659        struct PINT_server_rmdirent_op rmdirent;
660        struct PINT_server_io_op io;
661        struct PINT_server_small_io_op small_io;
662        struct PINT_server_flush_op flush;
663        struct PINT_server_truncate_op truncate;
664        struct PINT_server_mkdir_op mkdir;
665        struct PINT_server_mgmt_remove_dirent_op mgmt_remove_dirent;
666        struct PINT_server_mgmt_get_dirdata_op mgmt_get_dirdata_handle;
667        struct PINT_server_precreate_pool_refiller_op
668            precreate_pool_refiller;
669        struct PINT_server_batch_create_op batch_create;
670        struct PINT_server_batch_remove_op batch_remove;
671        struct PINT_server_unstuff_op unstuff;
672        struct PINT_server_create_copies_op create_copies;
673        struct PINT_server_mirror_op mirror;
674        struct PINT_server_tree_communicate_op tree_communicate;
675    } u;
676
677} PINT_server_op;
678
679#define PINT_CREATE_SUBORDINATE_SERVER_FRAME(__smcb, __s_op, __handle, __fs_id, __location, __req, __task_id) \
680    do { \
681      char server_name[1024]; \
682      struct server_configuration_s *server_config = get_server_config_struct(); \
683      __s_op = malloc(sizeof(struct PINT_server_op)); \
684      if(!__s_op) { return -PVFS_ENOMEM; } \
685      memset(__s_op, 0, sizeof(struct PINT_server_op)); \
686      __s_op->req = &__s_op->decoded.stub_dec.req; \
687      PINT_sm_push_frame(__smcb, __task_id, __s_op); \
688      if (__location != LOCAL_OPERATION && __location != REMOTE_OPERATION && __handle) { \
689        PINT_cached_config_get_server_name(server_name, 1024, __handle, __fs_id); \
690      } \
691      if (__location != REMOTE_OPERATION && (__location == LOCAL_OPERATION || ( __handle && ! strcmp(server_config->host_id, server_name)))) { \
692        __location = LOCAL_OPERATION; \
693        __req = __s_op->req; \
694        __s_op->prelude_mask = PRELUDE_SCHEDULER_DONE | PRELUDE_PERM_CHECK_DONE | PRELUDE_LOCAL_CALL; \
695      } \
696      else { \
697        memset(&__s_op->msgarray_op, 0, sizeof(PINT_sm_msgarray_op)); \
698        PINT_serv_init_msgarray_params(__s_op, __fs_id); \
699      } \
700    } while (0)
701
702
703/* PINT_ACCESS_DEBUG()
704 *
705 * macro for consistent printing of access records
706 *
707 * no return value
708 */
709#ifdef GOSSIP_DISABLE_DEBUG
710#define PINT_ACCESS_DEBUG(__s_op, __mask, format, f...) do {} while (0)
711#else
712#define PINT_ACCESS_DEBUG(__s_op, __mask, format, f...)                     \
713    PINT_server_access_debug(__s_op, __mask, format, ##f)
714#endif
715
716void PINT_server_access_debug(PINT_server_op * s_op,
717                              int64_t debug_mask,
718                              const char * format,
719                              ...) __attribute__((format(printf, 3, 4)));
720
721/* server side state machines */
722extern struct PINT_state_machine_s pvfs2_mirror_sm;
723extern struct PINT_state_machine_s pvfs2_pjmp_call_msgpairarray_sm;
724extern struct PINT_state_machine_s pvfs2_pjmp_get_attr_with_prelude_sm;
725extern struct PINT_state_machine_s pvfs2_pjmp_remove_work_sm;
726extern struct PINT_state_machine_s pvfs2_pjmp_mirror_work_sm;
727extern struct PINT_state_machine_s pvfs2_pjmp_create_immutable_copies_sm;
728extern struct PINT_state_machine_s pvfs2_pjmp_get_attr_work_sm;
729
730/* nested state machines */
731extern struct PINT_state_machine_s pvfs2_get_attr_work_sm;
732extern struct PINT_state_machine_s pvfs2_get_attr_with_prelude_sm;
733extern struct PINT_state_machine_s pvfs2_prelude_sm;
734extern struct PINT_state_machine_s pvfs2_prelude_work_sm;
735extern struct PINT_state_machine_s pvfs2_final_response_sm;
736extern struct PINT_state_machine_s pvfs2_check_entry_not_exist_sm;
737extern struct PINT_state_machine_s pvfs2_remove_work_sm;
738extern struct PINT_state_machine_s pvfs2_remove_with_prelude_sm;
739extern struct PINT_state_machine_s pvfs2_mkdir_work_sm;
740extern struct PINT_state_machine_s pvfs2_unexpected_sm;
741extern struct PINT_state_machine_s pvfs2_create_immutable_copies_sm;
742extern struct PINT_state_machine_s pvfs2_mirror_work_sm;
743extern struct PINT_state_machine_s pvfs2_tree_remove_work_sm;
744extern struct PINT_state_machine_s pvfs2_tree_get_file_size_work_sm;
745extern struct PINT_state_machine_s pvfs2_call_msgpairarray_sm;
746
747/* Exported Prototypes */
748struct server_configuration_s *get_server_config_struct(void);
749
750/* exported state machine resource reclamation function */
751int server_post_unexpected_recv(job_status_s *js_p);
752int server_state_machine_start( PINT_smcb *smcb, job_status_s *js_p);
753int server_state_machine_complete(PINT_smcb *smcb);
754int server_state_machine_terminate(PINT_smcb *smcb, job_status_s *js_p);
755
756/* lists of server ops */
757extern struct qlist_head posted_sop_list;
758extern struct qlist_head inprogress_sop_list;
759
760/* starts state machines not associated with an incoming request */
761int server_state_machine_alloc_noreq(
762    enum PVFS_server_op op, struct PINT_smcb ** new_op);
763int server_state_machine_start_noreq(
764    struct PINT_smcb *new_op);
765
766/* INCLUDE STATE-MACHINE.H DOWN HERE */
767#if 0
768#define PINT_OP_STATE       PINT_server_op
769#define PINT_OP_STATE_GET_MACHINE(_op) \
770    ((_op >= 0 && _op < PVFS_SERV_NUM_OPS) ? \
771    PINT_server_req_table[_op].params->sm : NULL)
772#endif
773
774#include "pvfs2-internal.h"
775
776struct PINT_state_machine_s *server_op_state_get_machine(int);
777
778#endif /* __PVFS_SERVER_H */
779
780/*
781 * Local variables:
782 *  c-indent-level: 4
783 *  c-basic-offset: 4
784 * End:
785 *
786 * vim: ts=8 sts=4 sw=4 expandtab
787 */
Note: See TracBrowser for help on using the browser.