linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.de>
Cc: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: balance: Sync the fs before balancing metadata chunks
Date: Wed, 27 Feb 2019 17:25:19 +0100	[thread overview]
Message-ID: <20190227162519.GX24609@twin.jikos.cz> (raw)
In-Reply-To: <3e574c54-f714-424e-78bb-4a251a864153@suse.de>

On Tue, Feb 26, 2019 at 01:55:06PM +0800, Qu Wenruo wrote:
> 
> 
> On 2019/2/26 上午1:21, David Sterba wrote:
> > On Tue, Jan 29, 2019 at 02:57:39PM +0800, Qu Wenruo wrote:
> >> The most straightforward is to sync the fs before balancing metadata
> >> chunks.
> >>
> >> We could enhance the kernel bytes_may_use calculation, but I doubt about
> >> the complexity.
> >> So I take the easy fix to reduce the false ENOSPC reports.
> > 
> > Agreed.
> > 
> >> +	/*
> >> +	 * There may be many over-reserved space for metadata block groups,
> >> +	 * especially for inlined file extents.
> >> +	 *
> >> +	 * Do a sync here will free those over-reserved space and hugely
> >> +	 * reduce the possibility of some false ENOSPC
> >> +	 */
> >> +	if (args->flags & BTRFS_BALANCE_METADATA) {
> >> +		ret = btrfs_util_sync(path);
> > 
> > As the fd is already open, we should use the _fd version,
> > 
> >> +		if (ret) {
> >> +			error("failed to sync the fs before balance: %m");
> >> +			ret = -errno;
> >> +			goto out;
> > 
> > and possibly only warn if there's an error returned as the sync failure
> > is not a critical condition.
> 
> AFAIK if we can't even sync the fs, the balance is definitely going to
> fail, as the most common failure mode for syncfs is RO fs, caused by
> aborted transaction.
> 
> Thus I still think we should error out. Or is there some other
> non-critical failure mode I missed?

The read-only filesystem will be checked when balance starts, that's
where it gets reported.

      reply	other threads:[~2019-02-27 16:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29  6:57 [PATCH] btrfs-progs: balance: Sync the fs before balancing metadata chunks Qu Wenruo
2019-02-25 17:21 ` David Sterba
2019-02-26  5:55   ` Qu Wenruo
2019-02-27 16:25     ` 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=20190227162519.GX24609@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    --cc=wqu@suse.de \
    /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 NNTP newsgroup(s).