Omar Sandoval 6ec047a0b8 btrfs: use correct count in btrfs_file_write_iter()
[ Upstream commit c09767a8960ca0500fb636bf73686723337debf4 ]

generic_write_checks() may modify iov_iter_count(), so we must get the
count after the call, not before. Using the wrong one has a couple of
consequences:

1. We check a longer range in check_can_nocow() for nowait than we're
   actually writing.
2. We create extra hole extent maps in btrfs_cont_expand(). As far as I
   can tell, this is harmless, but I might be missing something.

These issues are pretty minor, but let's fix it before something more
important trips on it.

Fixes: edf064e7c6fe ("btrfs: nowait aio support")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-27 14:51:12 +01:00
..
2019-08-06 19:06:51 +02:00
2019-12-13 08:52:23 +01:00
2019-12-17 20:35:18 +01:00
2019-12-13 08:52:36 +01:00
2018-08-17 16:20:28 -07:00
2019-12-13 08:51:59 +01:00
2020-01-09 10:19:03 +01:00
2018-08-17 16:20:27 -07:00
2018-08-18 11:44:53 -07:00
2019-11-20 18:46:04 +01:00
2019-05-02 09:58:59 +02:00
2018-08-21 18:19:09 -07:00