Whamcloud - gitweb
LU-9859 libcfs: move cfs_trace_data data to tracefile.c
[fs/lustre-release.git] / libcfs / libcfs / tracefile.c
index 06b925a..3f9ca12 100644 (file)
@@ -50,7 +50,8 @@
 #include <libcfs/linux/linux-fs.h>
 #include <libcfs/libcfs.h>
 
-/* XXX move things up to the top, comment */
+#define TCD_MAX_TYPES                  8
+
 union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned;
 
 char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
@@ -101,6 +102,12 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
                spin_unlock(&tcd->tcd_lock);
 }
 
+#define cfs_tcd_for_each(tcd, i, j)                                    \
+       for (i = 0; cfs_trace_data[i]; i++)                             \
+               for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd);     \
+                    j < num_possible_cpus();                           \
+                    j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)
+
 #define cfs_tcd_for_each_type_lock(tcd, i, cpu)                                \
        for (i = 0; cfs_trace_data[i] &&                                \
             (tcd = &(*cfs_trace_data[i])[cpu].tcd) &&                  \
@@ -263,27 +270,6 @@ static void cfs_tage_to_tail(struct cfs_trace_page *tage,
        list_move_tail(&tage->linkage, queue);
 }
 
-int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,
-                          struct list_head *stock)
-{
-       int i;
-
-       /*
-        * XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
-        * from here: this will lead to infinite recursion.
-        */
-
-       for (i = 0; i + tcd->tcd_cur_stock_pages < TCD_STOCK_PAGES ; ++ i) {
-               struct cfs_trace_page *tage;
-
-               tage = cfs_tage_alloc(gfp);
-               if (tage == NULL)
-                       break;
-               list_add_tail(&tage->linkage, stock);
-       }
-       return i;
-}
-
 /* return a page that has 'len' bytes left at the end */
 static struct cfs_trace_page *
 cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len)