Whamcloud - gitweb
LU-5577 obdclass: change loop indexes to unsigned
[fs/lustre-release.git] / libcfs / libcfs / debug.c
index c418fbb..417a494 100644 (file)
@@ -52,7 +52,7 @@ CFS_MODULE_PARM(libcfs_subsystem_debug, "i", int, 0644,
 EXPORT_SYMBOL(libcfs_subsystem_debug);
 
 unsigned int libcfs_debug = (D_CANTMASK |
-                             D_NETERROR | D_HA | D_CONFIG | D_IOCTL);
+                            D_NETERROR | D_HA | D_CONFIG | D_IOCTL | D_LFSCK);
 CFS_MODULE_PARM(libcfs_debug, "i", int, 0644,
                 "Lustre kernel debug mask");
 EXPORT_SYMBOL(libcfs_debug);
@@ -107,7 +107,7 @@ CFS_MODULE_PARM(libcfs_panic_on_lbug, "i", uint, 0644,
                 "Lustre kernel panic on LBUG");
 EXPORT_SYMBOL(libcfs_panic_on_lbug);
 
-cfs_atomic_t libcfs_kmemory = CFS_ATOMIC_INIT(0);
+atomic_t libcfs_kmemory = ATOMIC_INIT(0);
 EXPORT_SYMBOL(libcfs_kmemory);
 
 static wait_queue_head_t debug_ctlwq;
@@ -229,20 +229,26 @@ libcfs_debug_str2mask(int *mask, const char *str, int is_subsys)
  */
 void libcfs_debug_dumplog_internal(void *arg)
 {
-       CFS_DECL_JOURNAL_DATA;
+       static time_t last_dump_time;
+       time_t current_time;
+       DECL_JOURNAL_DATA;
 
-       CFS_PUSH_JOURNAL;
+       PUSH_JOURNAL;
 
-       if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0) {
+       current_time = cfs_time_current_sec();
+
+       if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0 &&
+           current_time > last_dump_time) {
+               last_dump_time = current_time;
                snprintf(debug_file_name, sizeof(debug_file_name) - 1,
                         "%s.%ld." LPLD, libcfs_debug_file_path_arr,
-                        cfs_time_current_sec(), (long_ptr_t)arg);
+                        current_time, (long_ptr_t)arg);
                printk(KERN_ALERT "LustreError: dumping log to %s\n",
                       debug_file_name);
                cfs_tracefile_dump_all_pages(debug_file_name);
                libcfs_run_debug_log_upcall(debug_file_name);
        }
-       CFS_POP_JOURNAL;
+       POP_JOURNAL;
 }
 
 int libcfs_debug_dumplog_thread(void *arg)
@@ -255,7 +261,7 @@ int libcfs_debug_dumplog_thread(void *arg)
 void libcfs_debug_dumplog(void)
 {
        wait_queue_t wait;
-       cfs_task_t    *dumper;
+       struct task_struct    *dumper;
        ENTRY;
 
        /* we're being careful to ensure that the kernel thread is
@@ -294,11 +300,11 @@ int libcfs_debug_init(unsigned long bufsize)
                libcfs_console_min_delay = CDEBUG_DEFAULT_MIN_DELAY;
        }
 
-        if (libcfs_debug_file_path != NULL) {
-                memset(libcfs_debug_file_path_arr, 0, PATH_MAX);
-                strncpy(libcfs_debug_file_path_arr, 
-                        libcfs_debug_file_path, PATH_MAX-1);
-        }
+       if (libcfs_debug_file_path != NULL) {
+               strlcpy(libcfs_debug_file_path_arr,
+                       libcfs_debug_file_path,
+                       sizeof(libcfs_debug_file_path_arr));
+       }
 
        /* If libcfs_debug_mb is set to an invalid value or uninitialized
         * then just make the total buffers smp_num_cpus * TCD_MAX_PAGES */