Whamcloud - gitweb
LU-1346 libcfs: cleanup macros in kp30.h
[fs/lustre-release.git] / libcfs / libcfs / tracefile.h
index b8124e2..1bdf0a5 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -90,7 +92,7 @@ extern void libcfs_unregister_panic_notifier(void);
 extern int  libcfs_panic_in_progress;
 extern int  cfs_trace_max_debug_mb(void);
 
-#define TCD_MAX_PAGES (5 << (20 - CFS_PAGE_SHIFT))
+#define TCD_MAX_PAGES (5 << (20 - PAGE_CACHE_SHIFT))
 #define TCD_STOCK_PAGES (TCD_MAX_PAGES)
 #define CFS_TRACEFILE_SIZE (500 << 20)
 
@@ -99,7 +101,7 @@ extern int  cfs_trace_max_debug_mb(void);
 /*
  * Private declare for tracefile
  */
-#define TCD_MAX_PAGES (5 << (20 - CFS_PAGE_SHIFT))
+#define TCD_MAX_PAGES (5 << (20 - PAGE_CACHE_SHIFT))
 #define TCD_STOCK_PAGES (TCD_MAX_PAGES)
 
 #define CFS_TRACEFILE_SIZE (500 << 20)
@@ -187,11 +189,11 @@ union cfs_trace_data_union {
 #define TCD_MAX_TYPES      8
 extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[CFS_NR_CPUS];
 
-#define cfs_tcd_for_each(tcd, i, j)                                       \
-    for (i = 0; cfs_trace_data[i] != NULL; i++)                           \
-        for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd);               \
-             j < cfs_num_possible_cpus();                                 \
-             j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)
+#define cfs_tcd_for_each(tcd, i, j)                                      \
+    for (i = 0; cfs_trace_data[i] != NULL; 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] &&                                      \
@@ -237,7 +239,7 @@ struct cfs_trace_page {
        /*
         * page itself
         */
-       cfs_page_t          *page;
+       struct page          *page;
        /*
         * linkage into one of the lists in trace_data_union or
         * page_collection
@@ -277,38 +279,34 @@ extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
 extern char *cfs_trace_console_buffers[CFS_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)
+static inline char *cfs_trace_get_console_buffer(void)
 {
-        unsigned int i = cfs_get_cpu();
-        unsigned int j = cfs_trace_buf_idx_get();
+       unsigned int i = get_cpu();
+       unsigned int j = cfs_trace_buf_idx_get();
 
-        return cfs_trace_console_buffers[i][j];
+       return cfs_trace_console_buffers[i][j];
 }
 
 static inline void
 cfs_trace_put_console_buffer(char *buffer)
 {
-        cfs_put_cpu();
+       put_cpu();
 }
 
-static inline struct cfs_trace_cpu_data *
-cfs_trace_get_tcd(void)
+static inline struct cfs_trace_cpu_data *cfs_trace_get_tcd(void)
 {
        struct cfs_trace_cpu_data *tcd =
-                &(*cfs_trace_data[cfs_trace_buf_idx_get()])[cfs_get_cpu()].tcd;
+               &(*cfs_trace_data[cfs_trace_buf_idx_get()])[get_cpu()].tcd;
 
        cfs_trace_lock_tcd(tcd, 0);
 
        return tcd;
 }
 
-static inline void
-cfs_trace_put_tcd (struct cfs_trace_cpu_data *tcd)
+static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd)
 {
        cfs_trace_unlock_tcd(tcd, 0);
-
-       cfs_put_cpu();
+       put_cpu();
 }
 
 int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, int gfp,
@@ -335,8 +333,8 @@ do {                                                                    \
 do {                                                                    \
         __LASSERT(tage != NULL);                                        \
         __LASSERT(tage->page != NULL);                                  \
-        __LASSERT(tage->used <= CFS_PAGE_SIZE);                         \
-        __LASSERT(cfs_page_count(tage->page) > 0);                      \
+       __LASSERT(tage->used <= PAGE_CACHE_SIZE);                         \
+       __LASSERT(page_count(tage->page) > 0);                      \
 } while (0)
 
 #endif /* LUSTRE_TRACEFILE_PRIVATE */