]> Git Repo - linux.git/commit
btrfs: fallback if compressed IO fails for ENOSPC
authorSweet Tea Dorminy <[email protected]>
Sat, 6 Apr 2024 08:45:02 +0000 (04:45 -0400)
committerDavid Sterba <[email protected]>
Wed, 17 Apr 2024 23:46:52 +0000 (01:46 +0200)
commit131a821a243f89be312ced9e62ccc37b2cf3846c
treefa4bbf668515f2bc10b96a18a529bc1b1bcd2e77
parent7192833c4e55b26e8f15ef58577867a1bc808036
btrfs: fallback if compressed IO fails for ENOSPC

In commit b4ccace878f4 ("btrfs: refactor submit_compressed_extents()"), if
an async extent compressed but failed to find enough space, we changed
from falling back to an uncompressed write to just failing the write
altogether. The principle was that if there's not enough space to write
the compressed version of the data, there can't possibly be enough space
to write the larger, uncompressed version of the data.

However, this isn't necessarily true: due to fragmentation, there could
be enough discontiguous free blocks to write the uncompressed version,
but not enough contiguous free blocks to write the smaller but
unsplittable compressed version.

This has occurred to an internal workload which relied on write()'s
return value indicating there was space. While rare, it has happened a
few times.

Thus, in order to prevent early ENOSPC, re-add a fallback to
uncompressed writing.

Fixes: b4ccace878f4 ("btrfs: refactor submit_compressed_extents()")
CC: [email protected] # 6.1+
Reviewed-by: Qu Wenruo <[email protected]>
Co-developed-by: Neal Gompa <[email protected]>
Signed-off-by: Neal Gompa <[email protected]>
Signed-off-by: Sweet Tea Dorminy <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
fs/btrfs/inode.c
This page took 0.052496 seconds and 4 git commands to generate.