summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
815248a)
When the libcfs_debug_mb module parameter is set
at module-load time it isn't range-checked. When
it is set via sysfs it is. This inconsistency
makes the code harder to follow.
It is quite safe to call cfs_trace_set_debug_mb()
and cfs_trace_get_debug_mb() before the module
is initialized as cfs_tcd_for_each() does nothing
before initializtion.
So change cfs_trace_set_debug_mb() - which does
range checking - to returned the ranged checked number (it currently
always returns zero) and use that as the new value, unless
cfs_trace_get_debug_mb() now returns a non-zero value.
Linux-commit:
205b154f3bd6fa3e95ceca8bba8d00122bb8fb04
Change-Id: I495097bbae138625e54a012bf06c96e62d206228
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/37828
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
-/*
- * 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;
up_write(&cfs_tracefile_sem);
up_write(&cfs_tracefile_sem);
}
int cfs_trace_get_debug_mb(void)
}
int cfs_trace_get_debug_mb(void)