Whamcloud - gitweb
LU-3963 libcfs: convert md[d/t]/mg[c/s] to linux atomic primitives
[fs/lustre-release.git] / libcfs / libcfs / tracefile.h
index 1bdf0a5..c7b4c42 100644 (file)
@@ -125,9 +125,9 @@ union cfs_trace_data_union {
                /*
                 * pages with trace records not yet processed by tracefiled.
                 */
-               cfs_list_t              tcd_pages;
+               struct list_head        tcd_pages;
                /* number of pages on ->tcd_pages */
-               unsigned long           tcd_cur_pages;
+               unsigned long           tcd_cur_pages;
 
                /*
                 * pages with trace records already processed by
@@ -139,9 +139,9 @@ union cfs_trace_data_union {
                 * (put_pages_on_daemon_list()). LRU pages from this list are
                 * discarded when list grows too large.
                 */
-               cfs_list_t              tcd_daemon_pages;
+               struct list_head        tcd_daemon_pages;
                /* number of pages on ->tcd_daemon_pages */
-               unsigned long           tcd_cur_daemon_pages;
+               unsigned long           tcd_cur_daemon_pages;
 
                /*
                 * Maximal number of pages allowed on ->tcd_pages and
@@ -173,7 +173,7 @@ union cfs_trace_data_union {
                 * TCD_STOCK_PAGES pagesful are consumed by trace records all
                 * emitted in non-blocking contexts. Which is quite unlikely.
                 */
-               cfs_list_t              tcd_stock_pages;
+               struct list_head        tcd_stock_pages;
                /* number of pages on ->tcd_stock_pages */
                unsigned long           tcd_cur_stock_pages;
 
@@ -183,11 +183,11 @@ union cfs_trace_data_union {
                /* The factors to share debug memory. */
                unsigned short          tcd_pages_factor;
        } tcd;
-       char __pad[CFS_L1_CACHE_ALIGN(sizeof(struct cfs_trace_cpu_data))];
+       char __pad[L1_CACHE_ALIGN(sizeof(struct cfs_trace_cpu_data))];
 };
 
 #define TCD_MAX_TYPES      8
-extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[CFS_NR_CPUS];
+extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
 
 #define cfs_tcd_for_each(tcd, i, j)                                      \
     for (i = 0; cfs_trace_data[i] != NULL; i++)                                  \
@@ -203,21 +203,13 @@ extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[CFS_NR_CPUS];
 /* XXX nikita: this declaration is internal to tracefile.c and should probably
  * be moved there */
 struct page_collection {
-       cfs_list_t      pc_pages;
-       /*
-        * spin-lock protecting ->pc_pages. It is taken by smp_call_function()
-        * call-back functions. XXX nikita: Which is horrible: all processors
-        * receive NMI at the same time only to be serialized by this
-        * lock. Probably ->pc_pages should be replaced with an array of
-        * NR_CPUS elements accessed locklessly.
-        */
-       spinlock_t      pc_lock;
+       struct list_head        pc_pages;
        /*
         * if this flag is set, collect_pages() will spill both
         * ->tcd_daemon_pages and ->tcd_pages to the ->pc_pages. Otherwise,
         * only ->tcd_pages are spilled.
         */
-       int             pc_want_daemon_pages;
+       int                     pc_want_daemon_pages;
 };
 
 /* XXX nikita: this declaration is internal to tracefile.c and should probably
@@ -225,9 +217,9 @@ struct page_collection {
 struct tracefiled_ctl {
        struct completion       tctl_start;
        struct completion       tctl_stop;
-       cfs_waitq_t             tctl_waitq;
+       wait_queue_head_t       tctl_waitq;
        pid_t                   tctl_pid;
-       cfs_atomic_t            tctl_shutdown;
+       atomic_t                tctl_shutdown;
 };
 
 /*
@@ -239,24 +231,24 @@ struct cfs_trace_page {
        /*
         * page itself
         */
-       struct page          *page;
+       struct page             *page;
        /*
         * linkage into one of the lists in trace_data_union or
         * page_collection
         */
-       cfs_list_t           linkage;
+       struct list_head        linkage;
        /*
         * number of bytes used within this page
         */
-       unsigned int         used;
+       unsigned int            used;
        /*
         * cpu that owns this page
         */
-       unsigned short       cpu;
+       unsigned short          cpu;
        /*
         * type(context) of this page
         */
-       unsigned short       type;
+       unsigned short          type;
 };
 
 extern void cfs_set_ptldebug_header(struct ptldebug_header *header,
@@ -276,7 +268,7 @@ extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
  * (see, for example, linux-tracefile.h).
  */
 
-extern char *cfs_trace_console_buffers[CFS_NR_CPUS][CFS_TCD_TYPE_MAX];
+extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
 extern cfs_trace_buf_type_t cfs_trace_buf_idx_get(void);
 
 static inline char *cfs_trace_get_console_buffer(void)
@@ -310,7 +302,7 @@ static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd)
 }
 
 int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, int gfp,
-                           cfs_list_t *stock);
+                               struct list_head *stock);
 
 
 int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd,