Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have
been replaced by is_power_of_2
Linux-commit:
d4891039904fa25edf1ca793a0469633ed81df3f
The following commit message is the same for the following
patches:
hash.c: Replace IS_PO2 by is_power_of_2
Linux-commit:
71872e9cc2af4dca1903ebc57daa15f08c795d86
selftest.h: replace IS_PO2 by is_power_of_2
Linux-commit:
b3367164f4ff8ff2c1aa8bd79c7548f113b62b83
workitem.c: replace IS_PO2 by is_power_of_2
Linux-commit:
57b573d14b0fb9f83575a2cf155862d251c8f0d1
ldlm_extent.c: replace IS_PO2 by is_power_of_2
Linux-commit:
5f4179e04b31441b0b7995d14320a457aafba01b
Replaces IS_PO2 by is_power_of_2. It is more accurate to use
is_power_of_2 since it returns 1 for numbers that are powers
of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are
powers of 2.
Change-Id: Ic8bb40394b46ea433e3096c878abe467eacc7996
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/24577
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
#define LIBCFS_VERSION "0.5.0"
#define LIBCFS_VERSION "0.5.0"
-static inline int __is_po2(unsigned long long val)
-{
- return !(val & (val - 1));
-}
-
-#define IS_PO2(val) __is_po2((unsigned long long)(val))
#define PO2_ROUNDUP_TYPED(x, po2, type) (-(-(type)(x) & -(type)(po2)))
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
#define PO2_ROUNDUP_TYPED(x, po2, type) (-(-(type)(x) & -(type)(po2)))
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
* table. Also, user can break the iteration by return 1 in callback.
*/
#include <linux/seq_file.h>
* table. Also, user can break the iteration by return 1 in callback.
*/
#include <linux/seq_file.h>
#include <libcfs/linux/linux-list.h>
#include <libcfs/libcfs.h>
#include <libcfs/linux/linux-list.h>
#include <libcfs/libcfs.h>
for (i = 2; cfs_hash_is_rehashing(hs); i++) {
cfs_hash_unlock(hs, 1);
/* raise console warning while waiting too long */
for (i = 2; cfs_hash_is_rehashing(hs); i++) {
cfs_hash_unlock(hs, 1);
/* raise console warning while waiting too long */
- CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO,
+ CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO,
"hash %s is still rehashing, rescheded %d\n",
hs->hs_name, i - 1);
cond_resched();
"hash %s is still rehashing, rescheded %d\n",
hs->hs_name, i - 1);
cond_resched();
int i = 2;
while (sched->ws_nthreads > 0) {
int i = 2;
while (sched->ws_nthreads > 0) {
- CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET,
+ CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET,
"waiting for %d threads of WI sched[%s] to "
"terminate\n", sched->ws_nthreads,
sched->ws_name);
"waiting for %d threads of WI sched[%s] to "
"terminate\n", sched->ws_nthreads,
sched->ws_name);
while (ptable->pt_zombies) {
spin_unlock(&ptable->pt_zombie_lock);
while (ptable->pt_zombies) {
spin_unlock(&ptable->pt_zombie_lock);
+ if (is_power_of_2(i)) {
CDEBUG(D_WARNING,
"Waiting for %d zombies on peer table\n",
ptable->pt_zombies);
CDEBUG(D_WARNING,
"Waiting for %d zombies on peer table\n",
ptable->pt_zombies);
do { \
int __I = 2; \
while (!(cond)) { \
do { \
int __I = 2; \
while (!(cond)) { \
- CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \
+ CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \
fmt, ## __VA_ARGS__); \
spin_unlock(&(lock)); \
\
fmt, ## __VA_ARGS__); \
spin_unlock(&(lock)); \
\
int index;
LASSERT(mode != 0);
int index;
LASSERT(mode != 0);
+ LASSERT(is_power_of_2(mode));
for (index = -1; mode != 0; index++, mode >>= 1)
/* do nothing */;
LASSERT(index < LCK_MODE_NUM);
for (index = -1; mode != 0; index++, mode >>= 1)
/* do nothing */;
LASSERT(index < LCK_MODE_NUM);