Btrfs: fix 64 bit divide problem
authorJosef Bacik <josef@redhat.com>
Sat, 20 Aug 2011 12:29:51 +0000 (08:29 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 21 Aug 2011 14:02:00 +0000 (07:02 -0700)
commit6719db6a23d4b7f1e5052eedae394135e3aef9c1
tree2faf96d69696df0edfc0ab4d8f0c980ee0b89986
parentc063d8a60fc912ae198f054608ad461a69dc9a19
Btrfs: fix 64 bit divide problem

This fixes a regression introduced by commit cdcb725c05fe ("Btrfs: check
if there is enough space for balancing smarter").  We can't do 64-bit
divides on 32-bit architectures.

In cases where we need to divide/multiply by 2 we should just left/right
shift respectively, and in cases where theres N number of devices use
do_div.  Also make the counters u64 to match up with rw_devices.
Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Acked-and-tested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/btrfs/extent-tree.c