Whamcloud - gitweb
LU-4423 lprocfs: use log2.h macros instead of shift loop. 74/35274/3
authorNeilBrown <neilb@suse.com>
Thu, 20 Jun 2019 03:43:30 +0000 (23:43 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 27 Jun 2019 21:34:05 +0000 (21:34 +0000)
commit0096afdb7404f649b69a8c528eed6c48593cb226
tree7d07b8f2ee7eb96b8f059198c480b7dd6fbe911f
parentb9fc8953d8b4ea769114ecab287d89b71ee5aba1
LU-4423 lprocfs: use log2.h macros instead of shift loop.

These shift loops seem to be trying to avoid doing a
multiplication.
The same effect can be achieved more transparently using
rounddown_pow_of_two().  Even though there is a multiplication
in the C code, the resulting machine code just does a single shift.

As rounddown_pow_of_two() is not defined for 0, and as we cannot be
positively use the blk_size is non-zero, use blk_size ?: 1.

Change-Id: Ie4cec1ca3f30617df0022a9c0dd80fe7e755ed64
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/35274
Tested-by: Jenkins
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lprocfs_status.c