]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: allow inline data extents creation if block size < page size
authorQu Wenruo <wqu@suse.com>
Fri, 15 Nov 2024 06:03:44 +0000 (16:33 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:49 +0000 (20:35 +0100)
Previously inline data extents creation was disabled if the block size
(previously called sector size) is smaller than the page size, for the
following reasons:

- Possible mixed inline and regular data extents
  However this is also the same if the block size matches the page size,
  thus we do not treat mixed inline and regular extents as an error.

  And the chance to cause mixed inline and regular data extents are not
  even increased, it has the same requirement (compressed inline data
  extent covering the whole first block, followed by regular extents).

- Inability to handle async/inline delalloc range for block size < page
  size cases
  This is already fixed since commit 1d2fbb7f1f9e ("btrfs: allow
  compression even if the range is not page aligned").

  This was the major technical obstacle, but it's not anymore.

With that removed, we can enable inline data extents creation no matter
the block size nor the page size, allowing btrfs to have the same
capacity for all block sizes.

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/inode.c

index c541183e3d22bd932a17b8604b5a26343838da96..012ac47351fce376995d124f8a6ea961f622faba 100644 (file)
@@ -566,19 +566,6 @@ static bool can_cow_file_range_inline(struct btrfs_inode *inode,
        if (offset != 0)
                return false;
 
-       /*
-        * Due to the page size limit, for subpage we can only trigger the
-        * writeback for the dirty sectors of page, that means data writeback
-        * is doing more writeback than what we want.
-        *
-        * This is especially unexpected for some call sites like fallocate,
-        * where we only increase i_size after everything is done.
-        * This means we can trigger inline extent even if we didn't want to.
-        * So here we skip inline extent creation completely.
-        */
-       if (fs_info->sectorsize != PAGE_SIZE)
-               return false;
-
        /* Inline extents are limited to sectorsize. */
        if (size > fs_info->sectorsize)
                return false;