struct trace_page *tage;
struct trace_page *tmp;
- /*
- * XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
- * from here: this will lead to infinite recursion.
- */
+ /*
+ * XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
+ * from here: this will lead to infinite recursion.
+ */
if (printk_ratelimit())
printk(KERN_WARNING "debug daemon buffer overflowed; "
{
struct trace_page *tage;
- /*
- * XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
- * from here: this will lead to infinite recursion.
- */
+ /*
+ * XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
+ * from here: this will lead to infinite recursion.
+ */
if (len > CFS_PAGE_SIZE) {
printk(KERN_ERR
}
if (format2) {
- remain = max_nob - needed;
+ remain = max_nob - needed;
if (remain < 0)
remain = 0;
{
int rc = 0;
- tracefile_write_lock();
+ tracefile_write_lock();
- if (strcmp(str, "stop") == 0) {
+ if (strcmp(str, "stop") == 0) {
tracefile_write_unlock();
trace_stop_thread();
tracefile_write_lock();
memset(tracefile, 0, sizeof(tracefile));
- } else if (strncmp(str, "size=", 5) == 0) {
- tracefile_size = simple_strtoul(str + 5, NULL, 0);
- if (tracefile_size < 10 || tracefile_size > 20480)
- tracefile_size = TRACEFILE_SIZE;
- else
- tracefile_size <<= 20;
+ } else if (strncmp(str, "size=", 5) == 0) {
+ tracefile_size = simple_strtoul(str + 5, NULL, 0);
+ if (tracefile_size < 10 || tracefile_size > 20480)
+ tracefile_size = TRACEFILE_SIZE;
+ else
+ tracefile_size <<= 20;
- } else if (strlen(str) >= sizeof(tracefile)) {
+ } else if (strlen(str) >= sizeof(tracefile)) {
rc = -ENAMETOOLONG;
#ifndef __WINNT__
} else if (str[0] != '/') {
trace_start_thread();
}
- tracefile_write_unlock();
- return rc;
+ tracefile_write_unlock();
+ return rc;
}
int trace_daemon_command_usrstr(void *usr_str, int usr_str_nob)
{
- char *str;
- int rc;
+ char *str;
+ int rc;
rc = trace_allocate_string_buffer(&str, usr_str_nob + 1);
if (rc != 0)
rc = trace_daemon_command(str);
trace_free_string_buffer(str, usr_str_nob + 1);
- return rc;
+ return rc;
}
int trace_set_debug_mb(int mb)
{
- int i;
+ int i;
int j;
int pages;
int limit = trace_max_debug_mb();
struct trace_cpu_data *tcd;
- if (mb < num_possible_cpus())
- return -EINVAL;
+ if (mb < num_possible_cpus())
+ return -EINVAL;
- if (mb > limit) {
- printk(KERN_ERR "Lustre: Refusing to set debug buffer size to "
- "%dMB - limit is %d\n", mb, limit);
- return -EINVAL;
- }
+ if (mb > limit) {
+ printk(KERN_ERR "Lustre: Refusing to set debug buffer size to "
+ "%dMB - limit is %d\n", mb, limit);
+ return -EINVAL;
+ }
- mb /= num_possible_cpus();
+ mb /= num_possible_cpus();
pages = mb << (20 - CFS_PAGE_SHIFT);
tracefile_write_lock();
tcd_for_each(tcd, i, j)
- tcd->tcd_max_pages = (pages * tcd->tcd_pages_factor) / 100;
+ tcd->tcd_max_pages = (pages * tcd->tcd_pages_factor) / 100;
tracefile_write_unlock();
- return 0;
+ return 0;
}
int trace_set_debug_mb_usrstr(void *usr_str, int usr_str_nob)
{
- char str[32];
+ char str[32];
int rc;
rc = trace_copyin_string(str, sizeof(str), usr_str, usr_str_nob);
if (rc < 0)
return rc;
- return trace_set_debug_mb(simple_strtoul(str, NULL, 0));
+ return trace_set_debug_mb(simple_strtoul(str, NULL, 0));
}
int trace_get_debug_mb(void)
{
- int i;
+ int i;
int j;
struct trace_cpu_data *tcd;
int total_pages = 0;
struct trace_page *tmp;
struct ptldebug_header *hdr;
cfs_file_t *filp;
+ int last_loop = 0;
int rc;
CFS_DECL_MMSPACE;
while (1) {
cfs_waitlink_t __wait;
- cfs_waitlink_init(&__wait);
- cfs_waitq_add(&tctl->tctl_waitq, &__wait);
- set_current_state(TASK_INTERRUPTIBLE);
- cfs_waitq_timedwait(&__wait, CFS_TASK_INTERRUPTIBLE,
- cfs_time_seconds(1));
- cfs_waitq_del(&tctl->tctl_waitq, &__wait);
-
- if (atomic_read(&tctl->tctl_shutdown))
- break;
-
pc.pc_want_daemon_pages = 0;
collect_pages(&pc);
if (list_empty(&pc.pc_pages))
- continue;
+ goto end_loop;
filp = NULL;
tracefile_read_lock();
if (filp == NULL) {
put_pages_on_daemon_list(&pc);
__LASSERT(list_empty(&pc.pc_pages));
- continue;
+ goto end_loop;
}
CFS_MMSPACE_OPEN;
printk(KERN_ERR "There are %d pages unwritten\n", i);
}
__LASSERT(list_empty(&pc.pc_pages));
+end_loop:
+ if (atomic_read(&tctl->tctl_shutdown)) {
+ if (last_loop == 0) {
+ last_loop = 1;
+ continue;
+ } else {
+ break;
+ }
+ }
+ cfs_waitlink_init(&__wait);
+ cfs_waitq_add(&tctl->tctl_waitq, &__wait);
+ set_current_state(TASK_INTERRUPTIBLE);
+ cfs_waitq_timedwait(&__wait, CFS_TASK_INTERRUPTIBLE,
+ cfs_time_seconds(1));
+ cfs_waitq_del(&tctl->tctl_waitq, &__wait);
}
complete(&tctl->tctl_stop);
return 0;