Whamcloud - gitweb
LU-1249 debug: Auto correct improper debug buffer size setting
authorBobi Jam <bobijam@whamcloud.com>
Mon, 9 Apr 2012 05:03:51 +0000 (13:03 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 30 Apr 2012 02:41:57 +0000 (22:41 -0400)
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 <bobijam@whamcloud.com>
Change-Id: I89def7762f2ec9da3a25d28f7ffa9aede390eb85
Reviewed-on: http://review.whamcloud.com/2489
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/tracefile.c
lustre/tests/cfg/local.sh

index 76b76ec..86eeea5 100644 (file)
@@ -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();
index 47184c7..121ad75 100644 (file)
@@ -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:-""}