Whamcloud - gitweb
LU-1346 libcfs: replace cfs_ memory wrappers
[fs/lustre-release.git] / libcfs / libcfs / tracefile.h
index a39ed41..196ab96 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,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/
@@ -92,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)
 
@@ -101,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)
@@ -119,7 +119,7 @@ union cfs_trace_data_union {
                 * and trace_put_tcd, which are called in libcfs_debug_vmsg2 and
                 * tcd_for_each_type_lock
                 */
-               cfs_spinlock_t          tcd_lock;
+               spinlock_t              tcd_lock;
                unsigned long           tcd_lock_flags;
 
                /*
@@ -198,12 +198,12 @@ extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[CFS_NR_CPUS];
 #define cfs_tcd_for_each_type_lock(tcd, i, cpu)                           \
     for (i = 0; cfs_trace_data[i] &&                                      \
          (tcd = &(*cfs_trace_data[i])[cpu].tcd) &&                        \
-         cfs_trace_lock_tcd(tcd); cfs_trace_unlock_tcd(tcd), i++)
+         cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)
 
 /* XXX nikita: this declaration is internal to tracefile.c and should probably
  * be moved there */
 struct page_collection {
-       cfs_list_t              pc_pages;
+       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
@@ -211,23 +211,23 @@ struct page_collection {
         * lock. Probably ->pc_pages should be replaced with an array of
         * NR_CPUS elements accessed locklessly.
         */
-       cfs_spinlock_t          pc_lock;
+       spinlock_t      pc_lock;
        /*
         * 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
  * be moved there */
 struct tracefiled_ctl {
-       cfs_completion_t       tctl_start;
-       cfs_completion_t       tctl_stop;
-       cfs_waitq_t            tctl_waitq;
-       pid_t                  tctl_pid;
-       cfs_atomic_t           tctl_shutdown;
+       struct completion       tctl_start;
+       struct completion       tctl_stop;
+       cfs_waitq_t             tctl_waitq;
+       pid_t                   tctl_pid;
+       cfs_atomic_t            tctl_shutdown;
 };
 
 /*
@@ -239,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
@@ -266,8 +266,8 @@ extern void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
                                  const char *buf, int len, const char *file,
                                  const char *fn);
 
-extern int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd);
-extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd);
+extern int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
+extern void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
 
 /**
  * trace_buf_type_t, trace_buf_idx_get() and trace_console_buffers[][]
@@ -300,7 +300,7 @@ 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_lock_tcd(tcd);
+       cfs_trace_lock_tcd(tcd, 0);
 
        return tcd;
 }
@@ -308,7 +308,7 @@ cfs_trace_get_tcd(void)
 static inline void
 cfs_trace_put_tcd (struct cfs_trace_cpu_data *tcd)
 {
-       cfs_trace_unlock_tcd(tcd);
+       cfs_trace_unlock_tcd(tcd, 0);
 
        cfs_put_cpu();
 }
@@ -337,8 +337,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 */