diff options
author | Omar Sandoval <osandov@fb.com> | 2019-11-18 22:45:55 -0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-03-14 13:13:51 +0100 |
commit | 28c9b1e75aa1794897a9cb709f20f27f4aadebac (patch) | |
tree | eff413c080922d074c0f750237e63e32ac3159e8 /fs/btrfs/file.c | |
parent | cb36a9bb17c4abf720123dacd449408588247005 (diff) | |
download | linux-28c9b1e75aa1794897a9cb709f20f27f4aadebac.tar.bz2 |
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>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 391b05019dbd..7b4a5458ca9b 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1719,7 +1719,8 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, fs_info->sectorsize); WARN_ON(reserve_bytes == 0); ret = btrfs_delalloc_reserve_metadata(BTRFS_I(inode), - reserve_bytes); + reserve_bytes, + reserve_bytes); if (ret) { if (!only_release_metadata) btrfs_free_reserved_data_space(BTRFS_I(inode), |