[27/28] lustre: ldlm: simplify lock_mode_to_index()
diff mbox series

Message ID 155168109905.31333.13609917410154153988.stgit@noble.brown
State New
Headers show
Series
  • More lustre patches...
Related show

Commit Message

NeilBrown March 4, 2019, 6:31 a.m. UTC
This function has the same effect as ilog2(), so just use ilog2
directly.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index 99aef0bee53c..b3d1a2565dbc 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -104,8 +104,7 @@  static inline int lock_mode_to_index(enum ldlm_mode mode)
 
 	LASSERT(mode != 0);
 	LASSERT(is_power_of_2(mode));
-	for (index = -1; mode; index++)
-		mode >>= 1;
+	index = ilog2(mode);
 	LASSERT(index < LCK_MODE_NUM);
 	return index;
 }