"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 cfs_waitq_t debug_ctlwq;
+static wait_queue_head_t debug_ctlwq;
char libcfs_debug_file_path_arr[PATH_MAX] = LIBCFS_DEBUG_FILE_PATH_DEFAULT;
*/
void libcfs_debug_dumplog_internal(void *arg)
{
- CFS_DECL_JOURNAL_DATA;
-
- CFS_PUSH_JOURNAL;
-
- if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0) {
- 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);
- printk(CFS_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;
+ static time_t last_dump_time;
+ time_t current_time;
+ DECL_JOURNAL_DATA;
+
+ PUSH_JOURNAL;
+
+ 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,
+ 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);
+ }
+ POP_JOURNAL;
}
int libcfs_debug_dumplog_thread(void *arg)
{
- libcfs_debug_dumplog_internal(arg);
- cfs_waitq_signal(&debug_ctlwq);
- return 0;
+ libcfs_debug_dumplog_internal(arg);
+ wake_up(&debug_ctlwq);
+ return 0;
}
void libcfs_debug_dumplog(void)
{
- cfs_waitlink_t wait;
- cfs_task_t *dumper;
- ENTRY;
+ wait_queue_t wait;
+ struct task_struct *dumper;
+ ENTRY;
- /* we're being careful to ensure that the kernel thread is
- * able to set our state to running as it exits before we
- * get to schedule() */
- cfs_waitlink_init(&wait);
- cfs_set_current_state(CFS_TASK_INTERRUPTIBLE);
- cfs_waitq_add(&debug_ctlwq, &wait);
+ /* we're being careful to ensure that the kernel thread is
+ * able to set our state to running as it exits before we
+ * get to schedule() */
+ init_waitqueue_entry_current(&wait);
+ set_current_state(TASK_INTERRUPTIBLE);
+ add_wait_queue(&debug_ctlwq, &wait);
dumper = kthread_run(libcfs_debug_dumplog_thread,
(void *)(long)current_pid(),
"libcfs_debug_dumper");
if (IS_ERR(dumper))
- printk(CFS_KERN_ERR "LustreError: cannot start log dump thread:"
+ printk(KERN_ERR "LustreError: cannot start log dump thread:"
" %ld\n", PTR_ERR(dumper));
- else
- cfs_waitq_wait(&wait, CFS_TASK_INTERRUPTIBLE);
+ else
+ waitq_wait(&wait, TASK_INTERRUPTIBLE);
- /* be sure to teardown if cfs_create_thread() failed */
- cfs_waitq_del(&debug_ctlwq, &wait);
- cfs_set_current_state(CFS_TASK_RUNNING);
+ /* be sure to teardown if cfs_create_thread() failed */
+ remove_wait_queue(&debug_ctlwq, &wait);
+ set_current_state(TASK_RUNNING);
}
EXPORT_SYMBOL(libcfs_debug_dumplog);
int libcfs_debug_init(unsigned long bufsize)
{
- int rc = 0;
- unsigned int max = libcfs_debug_mb;
+ int rc = 0;
+ unsigned int max = libcfs_debug_mb;
- cfs_waitq_init(&debug_ctlwq);
+ init_waitqueue_head(&debug_ctlwq);
- if (libcfs_console_max_delay <= 0 || /* not set by user or */
- libcfs_console_min_delay <= 0 || /* set to invalid values */
- libcfs_console_min_delay >= libcfs_console_max_delay) {
- libcfs_console_max_delay = CDEBUG_DEFAULT_MAX_DELAY;
- libcfs_console_min_delay = CDEBUG_DEFAULT_MIN_DELAY;
- }
+ if (libcfs_console_max_delay <= 0 || /* not set by user or */
+ libcfs_console_min_delay <= 0 || /* set to invalid values */
+ libcfs_console_min_delay >= libcfs_console_max_delay) {
+ libcfs_console_max_delay = CDEBUG_DEFAULT_MAX_DELAY;
+ libcfs_console_min_delay = CDEBUG_DEFAULT_MIN_DELAY;
+ }
if (libcfs_debug_file_path != NULL) {
memset(libcfs_debug_file_path_arr, 0, PATH_MAX);
void libcfs_debug_set_level(unsigned int debug_level)
{
- printk(CFS_KERN_WARNING "Lustre: Setting portals debug level to %08x\n",
- debug_level);
- libcfs_debug = debug_level;
+ printk(KERN_WARNING "Lustre: Setting portals debug level to %08x\n",
+ debug_level);
+ libcfs_debug = debug_level;
}
EXPORT_SYMBOL(libcfs_debug_set_level);