[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460492056-31792-13-git-send-email-jsimmons@infradead.org>
Date: Tue, 12 Apr 2016 16:14:12 -0400
From: James Simmons <jsimmons@...radead.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org,
Andreas Dilger <andreas.dilger@...el.com>,
Oleg Drokin <oleg.drokin@...el.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Lustre Development List <lustre-devel@...ts.lustre.org>,
Andrew Perepechko <andrew_perepechko@...atex.com>,
James Simmons <jsimmons@...radead.org>
Subject: [PATCH v2 12/16] staging: lustre: lprocfs: implement log2 using bitops
From: Andrew Perepechko <andrew_perepechko@...atex.com>
This patch implements log2 using fls.
Signed-off-by: Andrew Perepechko <andrew_perepechko@...atex.com>
Reviewed-by: Alexander Boyko <Alexander_Boyko@...atex.com>
Reviewed-by: alexander_zarochentsev@...atex.com
Reviewed-by: Vitaly Fertman <Vitaly_Fertman@...atex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3496
Xyratex-bug-id: MRP-999
Reviewed-on: http://review.whamcloud.com/6757
Reviewed-by: John L. Hammond <john.hammond@...el.com>
Reviewed-by: Bob Glossman <bob.glossman@...el.com>
Reviewed-by: Oleg Drokin <oleg.drokin@...el.com>
Signed-off-by: James Simmons <jsimmons@...radead.org>
---
.../lustre/lustre/obdclass/lprocfs_status.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 9824c88..b2f309d 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1472,10 +1472,10 @@ EXPORT_SYMBOL(lprocfs_oh_tally);
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);
}
--
1.7.1
Powered by blists - more mailing lists