Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Qu Wenruo <wqu@suse.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Qu Wenruo <quwenruo.btrfs@gmx.com>,
	Pedro Falcato <pfalcato@suse.de>, Christoph Hellwig <hch@lst.de>,
	Jann Horn <jannh@google.com>, David Howells <dhowells@redhat.com>,
	John Hubbard <jhubbard@nvidia.com>, Jan Kara <jack@suse.cz>,
	Rik van Riel <riel@surriel.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, linux-xfs@vger.kernel.org
Subject: Re: Removing ->dirty_folio
Date: Wed, 26 Aug 2026 06:53:04 +0200	[thread overview]
Message-ID: <20260826045304.GA15122@lst.de> (raw)
In-Reply-To: <cf3486b8-a506-4732-8274-b3179fb06a82@suse.com>

On Wed, Aug 26, 2026 at 08:03:38AM +0930, Qu Wenruo wrote:
>> Why is it hard to do it immediately at writeback time?  I think you're
>> in an even less restrictive locking environment than page_mkwrite is
>> called in because you're not under any MM locks.  According to
>> Documentation/filesystems/locking.rst, ->writepages is called with
>> absolutely no locks held.
>
> This space reservation problem is a btrfs specific problem.

Not entirely.  It really is an issue for everyone doing (forced) out of
place writes.

> The root problem here is, btrfs space reservation can trigger 
> writeback/transaction commit.

While zoned xfs doesn't actively trigger it, it still has to wait
for the GC daemon, so we're in exactly the same boat here.  The
space reservation has to be done without VFS locks, and in the
rare cases where we can't do that (->setattr for an unaligned
truncate) we have to play with fire and dip into a reserved pool.
It has been on my TODO list to fix up the VFS interfaces for
that to be called without locks held.

> This is due to the data/metadata COW nature, and that's why we rely 
> completely on buffered write to do space reservation, and avoid any extra 
> space reservation at writeback time.

That's the only sane thing to do, as at writeback time it is too late
to reserve space.


  reply	other threads:[~2026-08-26  4:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 19:08 Removing ->dirty_folio Matthew Wilcox
2026-08-24 19:25 ` John Hubbard
2026-08-24 19:43   ` Matthew Wilcox
2026-08-24 19:51     ` John Hubbard
2026-08-24 21:05       ` Matthew Wilcox
2026-08-25  7:59     ` Pedro Falcato
2026-08-24 19:33 ` Rik van Riel
2026-08-25  8:21   ` David Hildenbrand (Arm)
2026-08-24 21:27 ` Boris Burkov
2026-08-25 19:47   ` Matthew Wilcox
2026-08-24 22:38 ` Qu Wenruo
2026-08-25 19:26   ` Matthew Wilcox
2026-08-25 22:33     ` Qu Wenruo
2026-08-26  4:53       ` Christoph Hellwig [this message]
2026-08-26  8:01     ` Christoph Hellwig
2026-08-25  6:48 ` David Howells
2026-08-25 19:16   ` Matthew Wilcox
2026-08-25  7:39 ` Christoph Hellwig
2026-08-25 19:14   ` Matthew Wilcox
2026-08-25  8:25 ` Pedro Falcato
2026-08-25 18:35   ` Matthew Wilcox
2026-08-25 19:35 ` Jann Horn
2026-08-25 19:54   ` Matthew Wilcox
2026-08-25 20:06     ` Jann Horn
2026-08-26  0:02       ` Matthew Wilcox
2026-08-26  5:07     ` Christoph Hellwig
2026-08-26  7:42       ` Christoph Hellwig

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=20260826045304.GA15122@lst.de \
    --to=hch@lst.de \
    --cc=dhowells@redhat.com \
    --cc=djwong@kernel.org \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=pfalcato@suse.de \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=riel@surriel.com \
    --cc=willy@infradead.org \
    --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