]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix balance convert to single on 32-bit host CPUs
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Thu, 12 Sep 2019 23:55:01 +0000 (19:55 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 1 Oct 2019 17:37:29 +0000 (19:37 +0200)
commit04cc41475b9e79afd59de6ac53e51a50b6453e86
tree05c0597acdef1d01393fdc04482c0037ab02cd96
parent2e4a08b39908c1be26edddcc794f8d59fcaae78a
btrfs: fix balance convert to single on 32-bit host CPUs

Currently, the command:

btrfs balance start -dconvert=single,soft .

on a Raspberry Pi produces the following kernel message:

BTRFS error (device mmcblk0p2): balance: invalid convert data profile single

This fails because we use is_power_of_2(unsigned long) to validate
the new data profile, the constant for 'single' profile uses bit 48,
and there are only 32 bits in a long on ARM.

Fix by open-coding the check using u64 variables.

Tested by completing the original balance command on several Raspberry
Pis.

Fixes: aa933bcc10b0 ("btrfs: use common helper instead of open coding a bit test")
CC: stable@vger.kernel.org # 4.20+
Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c