X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=libcfs%2Flibcfs%2Fdebug.c;h=cd6cfdb7f77861dac4dd91deb8cb2648c6f7c79c;hb=0130d7019534611ff05a29fad657226d2eb6b79e;hp=99518ab116d1a09aa40d3d20e8717022343b28b6;hpb=ee7ca785615f2da71932512d8545763836ef8197;p=fs%2Flustre-release.git diff --git a/libcfs/libcfs/debug.c b/libcfs/libcfs/debug.c index 99518ab..cd6cfdb 100644 --- a/libcfs/libcfs/debug.c +++ b/libcfs/libcfs/debug.c @@ -65,21 +65,15 @@ static int libcfs_param_debug_mb_set(const char *val, if (rc < 0) return rc; -/* - * RHEL6 does not support any kind of locking so we have to provide - * our own - */ - if (!*((unsigned int *)kp->arg)) { - *((unsigned int *)kp->arg) = num; - return 0; - } + num = cfs_trace_set_debug_mb(num); - rc = cfs_trace_set_debug_mb(num); - - if (!rc) - *((unsigned int *)kp->arg) = cfs_trace_get_debug_mb(); + *((unsigned int *)kp->arg) = num; + num = cfs_trace_get_debug_mb(); + if (num) + /* This value is more precise */ + *((unsigned int *)kp->arg) = num; - return rc; + return 0; } /* @@ -138,7 +132,9 @@ static int param_get_delay(char *buffer, cfs_kernel_param_arg_t *kp) { unsigned int d = *(unsigned int *)kp->arg; - return sprintf(buffer, "%lu", jiffies_to_msecs(d * 10) / MSEC_PER_SEC); + param_get_byte(buffer, kp); + return sprintf(buffer, "%lu%c", jiffies_to_msecs(d * 10) / MSEC_PER_SEC, + strnchr(buffer, PAGE_SIZE, '\n') ? '\n' : '\0'); } unsigned int libcfs_console_max_delay; @@ -305,7 +301,7 @@ libcfs_debug_mask2str(char *str, int size, int mask, int is_subsys) len = 1; } else { /* space-separated tokens */ for (i = 0; i < 32; i++) { - if ((mask & (1 << i)) == 0) + if ((mask & BIT(i)) == 0) continue; token = fn(i); @@ -449,11 +445,10 @@ int libcfs_debug_init(unsigned long bufsize) 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 + /* If libcfs_debug_mb is uninitialized then just make the + * total buffers smp_num_cpus * TCD_MAX_PAGES */ - if (max > cfs_trace_max_debug_mb() || max < num_possible_cpus()) { + if (max < num_possible_cpus()) { max = TCD_MAX_PAGES; } else { max = (max / num_possible_cpus());