Linux-BTRFS Archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org, kernel-team@meta.com,
	Neal Gompa <neal@gompa.dev>
Subject: Re: [PATCH] btrfs: fallback if compressed IO fails for ENOSPC
Date: Tue, 9 Apr 2024 13:27:43 +0200	[thread overview]
Message-ID: <20240409112743.GC3492@twin.jikos.cz> (raw)
In-Reply-To: <4607d44ee4cf72a302d3adeba5d0ae99518a5f36.1712391866.git.sweettea-kernel@dorminy.me>

On Sat, Apr 06, 2024 at 04:45:02AM -0400, Sweet Tea Dorminy wrote:
> 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()")
> Co-developed-by: Neal Gompa <neal@gompa.dev>
> Signed-off-by: Neal Gompa <neal@gompa.dev>
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>

Reviewed-by: David Sterba <dsterba@suse.com>

      parent reply	other threads:[~2024-04-09 11:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06  8:45 [PATCH] btrfs: fallback if compressed IO fails for ENOSPC Sweet Tea Dorminy
2024-04-06  9:02 ` Qu Wenruo
2024-04-09 11:27 ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240409112743.GC3492@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@meta.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=neal@gompa.dev \
    --cc=sweettea-kernel@dorminy.me \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).