home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / src / io / job / job-desc-queue.h < prev    next >
C/C++ Source or Header  |  2010-08-17  |  4KB  |  171 lines

  1. /*
  2.  * (C) 2001 Clemson University and The University of Chicago
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */
  6.  
  7. /* functions for handling queues of jobs that the job interface is
  8.  * managing
  9.  */
  10.  
  11. #ifndef __JOB_DESC_QUEUE_H
  12. #define __JOB_DESC_QUEUE_H
  13.  
  14. #include "quicklist.h"
  15. #include "job.h"
  16. #include "pvfs2-types.h"
  17. #include "trove-types.h"
  18. #include "src/server/request-scheduler/request-scheduler.h"
  19. #include "thread-mgr.h"
  20.  
  21. /* describes BMI operations */
  22. struct bmi_desc
  23. {
  24.     bmi_op_id_t id;
  25.     bmi_error_code_t error_code;
  26.     bmi_size_t actual_size;
  27. };
  28.  
  29. /* describes trove operations */
  30. struct trove_desc
  31. {
  32.     TROVE_op_id id;
  33.     PVFS_size *out_size_p;
  34.     PVFS_vtag *vtag;
  35.     PVFS_fs_id fsid;
  36.     PVFS_error state;
  37.     PVFS_handle handle;
  38.     PVFS_ds_position position;
  39.     PVFS_ds_attributes attr;
  40.     PVFS_ds_type type;
  41.     int count;
  42. };
  43.  
  44. /* describes precreate pool operations */
  45. struct precreate_pool_desc
  46. {
  47.     PVFS_handle precreate_pool;
  48.     PVFS_fs_id fsid;
  49.     PVFS_handle* precreate_handle_array;
  50.     int precreate_handle_count;
  51.     int precreate_handle_index;
  52.     int posted_count;
  53.     const char** servers;
  54.     struct qlist_head* current_pool;
  55.     int trove_pending;
  56.     int low_threshold;
  57.     void* data;
  58.     int first_callback_flag;
  59.     TROVE_keyval_s* key_array;
  60.     PVFS_ds_flags flags;
  61.     PVFS_ds_position position;
  62.     PVFS_ds_position pool_index;
  63.     int count;
  64.     PVFS_ds_type type;              /* ds type of operation */
  65.     
  66.     PVFS_error error_code;
  67. };
  68.  
  69. /* describes unexpected BMI operations */
  70. struct bmi_unexp_desc
  71. {
  72.     struct BMI_unexpected_info *info;
  73. };
  74.  
  75. /* describes unexpected dev operations */
  76. struct dev_unexp_desc
  77. {
  78.     struct PINT_dev_unexp_info* info;
  79. };
  80.  
  81. /* describes flows */
  82. struct flow_desc
  83. {
  84.     flow_descriptor *flow_d;
  85.     PVFS_size last_amt_complete;
  86.     long timeout_sec;
  87. };
  88.  
  89. /* describes request scheduler elements */
  90. struct req_sched_desc
  91. {
  92.     req_sched_id id;
  93.     int post_flag;
  94.     int error_code;
  95. };
  96.  
  97. /* passes along error code for null jobs */
  98. struct null_info_desc
  99. {
  100.     int error_code;
  101. };
  102.  
  103. enum job_type
  104. {
  105.     JOB_BMI = 1,
  106.     JOB_BMI_UNEXP,
  107.     JOB_TROVE,
  108.     JOB_FLOW,
  109.     JOB_REQ_SCHED,
  110.     JOB_DEV_UNEXP,
  111.     JOB_REQ_SCHED_TIMER,
  112.     JOB_PRECREATE_POOL,
  113.     JOB_NULL
  114. };
  115.  
  116. /* describes a job, which may be one of several types */
  117. struct job_desc
  118. {
  119.     enum job_type type;        /* type of job */
  120.     job_id_t job_id;        /* job interface identifier */
  121.     void *job_user_ptr;        /* user pointer */
  122.     job_aint status_user_tag;   /* user supplied tag */
  123.     int completed_flag;        /* has the job finished? */
  124.     job_context_id context_id;  /* context */
  125.     struct PINT_thread_mgr_bmi_callback bmi_callback;  /* callback information */
  126.     struct PINT_thread_mgr_trove_callback trove_callback;  /* callback information */
  127.     PVFS_hint hints;
  128.  
  129.     /* union of information for lower level interfaces */
  130.     union
  131.     {
  132.     struct bmi_desc bmi;
  133.     struct trove_desc trove;
  134.     struct bmi_unexp_desc bmi_unexp;
  135.     struct flow_desc flow;
  136.     struct req_sched_desc req_sched;
  137.     struct dev_unexp_desc dev_unexp;
  138.     struct null_info_desc null_info;
  139.         struct precreate_pool_desc precreate_pool;
  140.     }
  141.     u;
  142.  
  143.     struct qlist_head job_desc_q_link;    /* queue link */
  144.     struct qlist_head job_time_link;    /* queue link */
  145.     void* time_bucket;
  146. };
  147.  
  148. typedef struct qlist_head *job_desc_q_p;
  149.  
  150. struct job_desc *alloc_job_desc(int type);
  151. void dealloc_job_desc(struct job_desc *jd);
  152. job_desc_q_p job_desc_q_new(void);
  153. void job_desc_q_cleanup(job_desc_q_p jdqp);
  154. void job_desc_q_add(job_desc_q_p jdqp,
  155.             struct job_desc *desc);
  156. void job_desc_q_remove(struct job_desc *desc);
  157. int job_desc_q_empty(job_desc_q_p jdqp);
  158. struct job_desc *job_desc_q_shownext(job_desc_q_p jdqp);
  159. void job_desc_q_dump(job_desc_q_p jdqp);
  160.  
  161. #endif /* __JOB_DESC_QUEUE_H */
  162.  
  163. /*
  164.  * Local variables:
  165.  *  c-indent-level: 4
  166.  *  c-basic-offset: 4
  167.  * End:
  168.  *
  169.  * vim: ts=8 sts=4 sw=4 expandtab
  170.  */
  171.