]> git.proxmox.com Git - mirror_spl-debian.git/blobdiff - module/spl/spl-debug.c
Imported Upstream version 0.6.2
[mirror_spl-debian.git] / module / spl / spl-debug.c
index 4bcc34a8ef62ebce56706c64d83077b93ce3400a..d450368b1038084646e6068a375f2bc9990e9eee 100644 (file)
@@ -6,7 +6,7 @@
  *  UCRL-CODE-235197
  *
  *  This file is part of the SPL, Solaris Porting Layer.
- *  For details, see <http://github.com/behlendorf/spl/>.
+ *  For details, see <http://zfsonlinux.org/>.
  *
  *  The SPL is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License as published by the
@@ -36,6 +36,7 @@
 #include <linux/spinlock.h>
 #include <linux/proc_compat.h>
 #include <linux/file_compat.h>
+#include <linux/swap.h>
 #include <sys/sysmacros.h>
 #include <spl-debug.h>
 #include <spl-trace.h>
@@ -548,7 +549,7 @@ trace_print_to_console(struct spl_debug_header *hdr, int mask, const char *buf,
 static int
 trace_max_debug_mb(void)
 {
-        return MAX(512, ((num_physpages >> (20 - PAGE_SHIFT)) * 80) / 100);
+        return MAX(512, ((totalram_pages >> (20 - PAGE_SHIFT)) * 80) / 100);
 }
 
 static struct trace_page *
@@ -686,9 +687,8 @@ spl_debug_msg(void *arg, int subsys, int mask, const char *file,
         if (strchr(file, '/'))
                 file = strrchr(file, '/') + 1;
 
-        trace_set_debug_header(&header, subsys, mask, line, 0);
-
         tcd = trace_get_tcd();
+        trace_set_debug_header(&header, subsys, mask, line, 0);
         if (tcd == NULL)
                 goto console;
 
@@ -1100,10 +1100,11 @@ void spl_debug_bug(char *file, const char *func, const int line, int flags)
                 spl_panic_in_progress = 1;
 
         spl_debug_dumpstack(NULL);
-        spl_debug_dumplog(flags);
 
-        if (spl_debug_panic_on_bug)
+        if (spl_debug_panic_on_bug) {
+                spl_debug_dumplog(flags);
                 panic("SPL PANIC");
+        }
 
         set_task_state(current, TASK_UNINTERRUPTIBLE);
         while (1)
@@ -1188,7 +1189,7 @@ spl_debug_init(void)
 
         /* If spl_debug_mb is set to an invalid value or uninitialized
          * then just make the total buffers smp_num_cpus TCD_MAX_PAGES */
-        if (max > (num_physpages >> (20 - 2 - PAGE_SHIFT)) / 5 ||
+        if (max > (totalram_pages >> (20 - 2 - PAGE_SHIFT)) / 5 ||
             max >= 512 || max < 0) {
                 max = TCD_MAX_PAGES;
         } else {