btrfs: factor out nocow ordered extent and extent map generation into a helper
authorQu Wenruo <wqu@suse.com>
Mon, 13 Jan 2025 03:23:41 +0000 (13:53 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:41 +0000 (20:35 +0100)
commit10326fdcb3ace2f2dcbc8b9fc50b87e5cab93345
tree99eba1b5c73e2bf14bf29b1ede844bb0870466bd
parentecde48a1a6b3256bd49db8780bf37556b157783c
btrfs: factor out nocow ordered extent and extent map generation into a helper

Currently we're doing all the ordered extent and extent map generation
inside a while() loop of run_delalloc_nocow().  This makes it pretty
hard to read, nor doing proper error handling.

So move that part of code into a helper, nocow_one_range().

This should not change anything, but there is a tiny timing change where
btrfs_dec_nocow_writers() is only called after nocow_one_range() helper
exits.

This timing change is small, and makes error handling easier, thus
should be fine.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c