From: Bobi Jam Date: Mon, 9 Apr 2012 05:03:51 +0000 (+0800) Subject: LU-1249 debug: Auto correct improper debug buffer size setting X-Git-Tag: 2.2.52~22 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3bfe9e76c7f2ea74af97ef60d3b293f6068b0fdc LU-1249 debug: Auto correct improper debug buffer size setting Use the minimum required value when the debug buffer size setting value is too small, and use the maximum acceptable value when it is too large. Signed-off-by: Bobi Jam Change-Id: I89def7762f2ec9da3a25d28f7ffa9aede390eb85 Reviewed-on: http://review.whamcloud.com/2489 Reviewed-by: Lai Siyao Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index 76b76ec..86eeea5 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -931,15 +931,17 @@ int cfs_trace_set_debug_mb(int mb) struct cfs_trace_cpu_data *tcd; if (mb < cfs_num_possible_cpus()) { - printk(KERN_ERR "Cannot set debug_mb to %d, the value should be >= %d\n", - mb, cfs_num_possible_cpus()); - return -EINVAL; + printk(CFS_KERN_WARNING + "Lustre: %d MB is too small for debug buffer size, " + "setting it to %d MB.\n", mb, cfs_num_possible_cpus()); + mb = cfs_num_possible_cpus(); } if (mb > limit) { - printk(CFS_KERN_ERR "Lustre: Refusing to set debug buffer size " - "to %dMB - limit is %d\n", mb, limit); - return -EINVAL; + printk(CFS_KERN_WARNING + "Lustre: %d MB is too large for debug buffer size, " + "setting it to %d MB.\n", mb, limit); + mb = limit; } mb /= cfs_num_possible_cpus(); diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index 47184c7..121ad75 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -53,13 +53,6 @@ else _debug_mb=$(($(getconf _NPROCESSORS_CONF)*2)) fi -# but not less then 10Mb, and limited by 512Mb in libcfs -if (( _debug_mb < 10 )); then - _debug_mb=10 -elif ((_debug_mb > 512 )); then - _debug_mb=512 -fi - DEBUG_SIZE=${DEBUG_SIZE:-$_debug_mb} ENABLE_QUOTA=${ENABLE_QUOTA:-""}