btrfs: make btrfs_start_delalloc_root's nr argument a long
authorNikolay Borisov <nborisov@suse.com>
Mon, 11 Jan 2021 10:58:11 +0000 (12:58 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:51 +0000 (22:58 +0100)
commit9db4dc241e87fccd8301357d5ef908f40b50f2e3
treecee9af39a3bc30b46e0952ccd696bf170d1018db
parent9c4a062a94752dabd3954ef39c4dfed581c664b9
btrfs: make btrfs_start_delalloc_root's nr argument a long

It's currently u64 which gets instantly translated either to LONG_MAX
(if U64_MAX is passed) or cast to an unsigned long (which is in fact,
wrong because writeback_control::nr_to_write is a signed, long type).

Just convert the function's argument to be long time which obviates the
need to manually convert u64 value to a long. Adjust all call sites
which pass U64_MAX to pass LONG_MAX. Finally ensure that in
shrink_delalloc the u64 is converted to a long without overflowing,
resulting in a negative number.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/dev-replace.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/space-info.c