]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: cleanup the reserved space inside loop of btrfs_buffered_write()
authorQu Wenruo <wqu@suse.com>
Thu, 20 Mar 2025 02:37:31 +0000 (13:07 +1030)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:38 +0000 (14:30 +0200)
commitafe990fb59c152adef5a80c9168e990e2610b1f7
tree83abe653a97ebaaef94e2a81f87f47476144d835
parent563bd2b78581313599f7ca63d3a07b8b81a3fb01
btrfs: cleanup the reserved space inside loop of btrfs_buffered_write()

Inside the main loop of btrfs_buffered_write(), if something wrong
happened, there is a out-of-loop cleanup path to release the reserved
space.

This behavior saves some code lines, but makes it much harder to read,
as we need to check release_bytes to make sure when we need to do the
cleanup.

Factor out the cleanup part into a helper, release_reserved_space(), to
do the cleanup inside the main loop, so that we can move @release_bytes
inside the loop.

This will make later refactoring of the main loop much easier.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c