Re: [PATCH AUTOSEL 5.11 54/67] btrfs: make btrfs_start_delalloc_root's nr argument a long

From: Sasha Levin
Date: Thu Mar 04 2021 - 17:24:56 EST


On Wed, Feb 24, 2021 at 07:09:42PM +0100, David Sterba wrote:
On Wed, Feb 24, 2021 at 07:50:12AM -0500, Sasha Levin wrote:
From: Nikolay Borisov <nborisov@xxxxxxxx>

[ Upstream commit 9db4dc241e87fccd8301357d5ef908f40b50f2e3 ]

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.

This patch is a cleanup and I don't see any other patch depend on it, so
please drop it from autosel.

I'll drop it, thanks!

--
Thanks,
Sasha