Commit 322489d9 authored by Pekka Enberg's avatar Pekka Enberg Committed by Greg Kroah-Hartman

staging/lustre: Use roundup_pow_of_two() in LNetEQAlloc()

Use roundup_pow_of_two() and drop the private cfs_power2_roundup()
implementation.
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36fc2448
...@@ -496,19 +496,6 @@ static inline size_t cfs_round_strlen(char *fset) ...@@ -496,19 +496,6 @@ static inline size_t cfs_round_strlen(char *fset)
return (size_t)cfs_size_round((int)strlen(fset) + 1); return (size_t)cfs_size_round((int)strlen(fset) + 1);
} }
/* roundup \a val to power2 */
static inline unsigned int cfs_power2_roundup(unsigned int val)
{
if (val != LOWEST_BIT_SET(val)) { /* not a power of 2 already */
do {
val &= ~LOWEST_BIT_SET(val);
} while (val != LOWEST_BIT_SET(val));
/* ...and round up */
val <<= 1;
}
return val;
}
#define LOGL(var, len, ptr) \ #define LOGL(var, len, ptr) \
do { \ do { \
if (var) \ if (var) \
......
...@@ -79,7 +79,7 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, ...@@ -79,7 +79,7 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
* overflow, they don't skip entries, so the queue has the same * overflow, they don't skip entries, so the queue has the same
* apparent capacity at all times */ * apparent capacity at all times */
count = cfs_power2_roundup(count); count = roundup_pow_of_two(count);
if (callback != LNET_EQ_HANDLER_NONE && count != 0) if (callback != LNET_EQ_HANDLER_NONE && count != 0)
CWARN("EQ callback is guaranteed to get every event, do you still want to set eqcount %d for polling event which will have locking overhead? Please contact with developer to confirm\n", count); CWARN("EQ callback is guaranteed to get every event, do you still want to set eqcount %d for polling event which will have locking overhead? Please contact with developer to confirm\n", count);
......
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