arch-ppc.h: Add ilog2 implementation for ppc64
authorChandan Rajendra <chandan@linux.vnet.ibm.com>
Tue, 11 Aug 2015 09:41:26 +0000 (15:11 +0530)
committerJens Axboe <axboe@fb.com>
Thu, 13 Aug 2015 18:45:20 +0000 (12:45 -0600)
commit92060d6c59f1848e86cd9ddd7550907c79bda3d5
treeb18b2b5d3de6d202b3eca3e31faa638820b94f0b
parente155cb64ad042af42aafef26d1decf29c03e85d4
arch-ppc.h: Add ilog2 implementation for ppc64

On a ppc64 machine, when fio is invoked with the following configuration file
(generated by fstests' generic/300 test), it loops indefinitely.

[global]
directory=/mnt/btrfs-xfstest-scratch
filesize=536870912
size=999G
continue_on_error=write
ignore_error=,ENOSPC
error_dump=0

create_on_open=1
fallocate=none
exitall=1

[direct_aio_raicer]
ioengine=libaio
iodepth=128*1
bs=128k
direct=1
numjobs=4
rw=randwrite
runtime=100*1
time_based
filename=racer

[falloc_raicer]
ioengine=falloc
runtime=100*1
iodepth=1
bssplit=128k/80:512k/10:32k/10
rw=randwrite
numjobs=1
filename=racer

[punch_hole_raicer]
ioengine=falloc
runtime=100*1
bs=4k
time_based=10
rw=randtrim
numjobs=2
filename=racer
time_based

[aio-dio-verifier]
ioengine=libaio
iodepth=128*1
numjobs=1
verify=crc32c-intel
verify_fatal=1
verify_dump=1
verify_backlog=1024
verify_async=4
verifysort=1
direct=1
bs=4k
rw=randwrite
filename=aio-dio-verifier

This is because arch_ffz() ends up invoking the 32-bit version of __ilog2()
which always returns a bit number in the range 0 - 31. This can cause
"overlap" variable in axmap_set_fn() to never becomes zero.

To fix this the commit adds a 64-bit version of __ilog2() (obtained from the
Linux kernel's arch/powerpc/include/asm/bitops.h).

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
arch/arch-ppc.h