Whamcloud - gitweb
LU-2590 lod: magic changed after swab
[fs/lustre-release.git] / libcfs / libcfs / tracefile.h
index 5794d33..968c128 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.
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * 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/
@@ -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;
 };
 
 /*
@@ -260,14 +260,14 @@ struct cfs_trace_page {
 };
 
 extern void cfs_set_ptldebug_header(struct ptldebug_header *header,
-                                    int subsys, int mask, const int line,
+                                    struct libcfs_debug_msg_data *m,
                                     unsigned long stack);
 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();
 }
@@ -320,25 +320,26 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, int gfp,
 int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd,
                       struct cfs_trace_page *tage);
 
-extern void cfs_trace_assertion_failed(const char *str, const char *fn,
-                                       const char *file, int line);
+extern void cfs_trace_assertion_failed(const char *str,
+                                       struct libcfs_debug_msg_data *m);
 
 /* ASSERTION that is safe to use within the debug system */
 #define __LASSERT(cond)                                                 \
-    do {                                                                \
+do {                                                                    \
         if (unlikely(!(cond))) {                                        \
+                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_EMERG, NULL);     \
                 cfs_trace_assertion_failed("ASSERTION("#cond") failed", \
-                                 __FUNCTION__, __FILE__, __LINE__);     \
+                                           &msgdata);                   \
         }                                                               \
-    } while (0)
+} while (0)
 
 #define __LASSERT_TAGE_INVARIANT(tage)                                  \
-    do {                                                                \
+do {                                                                    \
         __LASSERT(tage != NULL);                                        \
         __LASSERT(tage->page != NULL);                                  \
         __LASSERT(tage->used <= CFS_PAGE_SIZE);                         \
         __LASSERT(cfs_page_count(tage->page) > 0);                      \
-    } while (0)
+} while (0)
 
 #endif /* LUSTRE_TRACEFILE_PRIVATE */