btrfs: fold error checks when allocating ordered extent and update comments
authorFilipe Manana <fdmanana@suse.com>
Wed, 7 May 2025 15:05:06 +0000 (16:05 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:56 +0000 (14:30 +0200)
commit87417e0cbbf30447e3549d16a682deebcd87aa9c
tree5addbdda6bd574f58a7e1710a513374c07f719bd
parent08c649a5637371cb6bf8f3e974323cf59a7f434b
btrfs: fold error checks when allocating ordered extent and update comments

Instead of having an error check and return on each branch of the if
statement, move the error check to happen after that if branch, reducing
source code and object code sizes.

Before this change:

   $ size fs/btrfs/btrfs.ko
      text    data     bss     dec     hex filename
   1840174  163742   16136 2020052  1ed2d4 fs/btrfs/btrfs.ko

After this change:

   $ size fs/btrfs/btrfs.ko
      text    data     bss     dec     hex filename
   1840138  163742   16136 2020016  1ed2b0 fs/btrfs/btrfs.ko

While at it and moving the comments, update the comments to be more clear
about how qgroup reserved space is released and the intricacies of how
it's managed for COW writes.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ordered-data.c