btrfs: calculate num_pages, reserve_bytes once in btrfs_buffered_write
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Fri, 25 Sep 2020 20:36:38 +0000 (15:36 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:53:37 +0000 (15:53 +0100)
commiteefa45f593792827771cfd845ab12fea5a7c7cd9
treea7e0e8671fb8dc313ad35e5a38db65acf8716ddf
parentfb8a7e941b1b4c1c2fa79b305d4c3fc41ad9bbda
btrfs: calculate num_pages, reserve_bytes once in btrfs_buffered_write

write_bytes can change in btrfs_check_nocow_lock(). Calculate variables
such as num_pages and reserve_bytes once we are sure of the value of
write_bytes so there is no need to re-calculate.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c