Commit b3ffe666 authored by Andrew Perepechko's avatar Andrew Perepechko Committed by Greg Kroah-Hartman

staging: lustre: lprocfs: implement log2 using bitops

This patch implements log2 using fls.
Signed-off-by: default avatarAndrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: default avatarAlexander Boyko <Alexander_Boyko@xyratex.com>
Reviewed-by: alexander_zarochentsev@xyratex.com
Reviewed-by: default avatarVitaly Fertman <Vitaly_Fertman@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3496
Xyratex-bug-id: MRP-999
Reviewed-on: http://review.whamcloud.com/6757Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarBob Glossman <bob.glossman@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b59d812d
...@@ -1472,10 +1472,10 @@ EXPORT_SYMBOL(lprocfs_oh_tally); ...@@ -1472,10 +1472,10 @@ EXPORT_SYMBOL(lprocfs_oh_tally);
void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
{ {
unsigned int val; unsigned int val = 0;
for (val = 0; ((1 << val) < value) && (val <= OBD_HIST_MAX); val++) if (likely(value != 0))
; val = min(fls(value - 1), OBD_HIST_MAX);
lprocfs_oh_tally(oh, val); lprocfs_oh_tally(oh, val);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment