diff --git a/fs/lustre/ldlm/ldlm_extent.c b/fs/lustre/ldlm/ldlm_extent.c index 77d3e79..7c72d04 100644 --- a/fs/lustre/ldlm/ldlm_extent.c +++ b/fs/lustre/ldlm/ldlm_extent.c @@ -139,8 +139,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; }