Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1374770

[PATCH 12/17] staging: lustre: lprocfs: implement log2 using bitops

From James Simmons <jsimmons@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 12/17] staging: lustre: lprocfs: implement log2 using bitops
Date 2016-04-10 15:20 +0200
Message-ID <rmnru-5Be-47@gated-at.bofh.it> (permalink)
References <rmnrr-5Be-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Andrew Perepechko <andrew_perepechko@xyratex.com>

This patch implements log2 using fls.

Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: Alexander Boyko <Alexander_Boyko@xyratex.com>
Reviewed-by: alexander_zarochentsev@xyratex.com
Reviewed-by: Vitaly 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/6757
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.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 d93f42f..172fc91 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1471,10 +1471,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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 00/17] staging : lustre : rest of missing patches from 2.5.0 release James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 11/17] staging: lustre: osc: osc_extent_wait() shouldn't be interruptible James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 15/17] staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 03/17] staging: lustre: ldlm: Fix a race during FLock handling James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 10/17] staging: lustre: llite: Truncate to restore file James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 02/17] staging: lustre: clio: incorrect assertions in 'enable-invariants' James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 17/17] staging: lustre: hsm: don't use real suppgid James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 09/17] staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init() James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 06/17] staging: lustre: llite: speedup in unlink/rmdir James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 08/17] staging: lustre: obd: MDT mount fails on MDS w/o MGS on it James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 04/17] staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 14/17] staging: lustre: lov: return minimal FIEMAP for released files James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200
  [PATCH 12/17] staging: lustre: lprocfs: implement log2 using bitops James Simmons <jsimmons@infradead.org> - 2016-04-10 15:20 +0200

csiph-web