btrfs: support different disk extent size for delalloc
authorOmar Sandoval <osandov@fb.com>
Tue, 19 Nov 2019 06:45:55 +0000 (22:45 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 Feb 2022 15:20:02 +0000 (16:20 +0100)
commitec54aa10f01672c2155fb2e25ca35d11ea72ebe5
tree7c8987c7b855c5f78edd17ce4a913b27333bf0c8
parent62ac9cef96f195085507a04611c60331fde85cdc
btrfs: support different disk extent size for delalloc

Currently, we always reserve the same extent size in the file and extent
size on disk for delalloc because the former is the worst case for the
latter. For BTRFS_IOC_ENCODED_WRITE writes, we know the exact size of
the extent on disk, which may be less than or greater than (for
bookends) the size in the file. Add a disk_num_bytes parameter to
btrfs_delalloc_reserve_metadata() so that we can reserve the correct
amount of csum bytes. No functional change.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
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>
fs/btrfs/ctree.h
fs/btrfs/delalloc-space.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/relocation.c