From: David Sterba <dsterba@suse.cz>
To: Tal Zussman <tz2294@columbia.edu>
Cc: David Sterba <dsterba@suse.com>, Chris Mason <mason@kernel.org>,
Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 00/15] btrfs: remove the v1 space cache
Date: Wed, 9 Sep 2026 03:08:46 +0200 [thread overview]
Message-ID: <20260909010846.GH9053@suse.cz> (raw)
In-Reply-To: <20260907-btrfs-remove-v1-space-cache-v1-0-5f9a5ba352a7@columbia.edu>
On Mon, Sep 07, 2026 at 09:19:15PM -0400, Tal Zussman wrote:
> Since commit 545e560a5b0f ("btrfs: disable v1 space cache") the mount
> options can't select the v1 space cache anymore, but the code is all
> still there, and a filesystem with an old cache and no free space tree
> still enabled it from the superblock. Qu suggested removing it rather
> than converting its page handling to folios [1].
>
> Patch 1 stops enabling the cache from the on-disk state, so an existing
> cache is cleaned up on the next read-write mount, as -o nospace_cache
> already did. This is the one user-visible change: the cleanup is now
> unconditional, and a read-write mount fails if it fails.
In case it fails there are 2 ways how to fix it:
- convert to free space tree during mount (the recommended conversion
from v1 to v2) but it could fail for the same reason
- on unmounted filesystem do 'btrfs rescue clear-space-cache v1'
> Patches 2-5
> remove the write path, 6 and 7 the load path and disk_cache_state, and
> 8 and 9 the SPACE_CACHE flag and the unused half of the cleanup helper.
> Patches 10-15 remove the trimming ranges and the free space inode
> special cases in the write path, which only the v1 writer used.
The piecemeal removal is good, makes it clear what's still needed, as
listed below.
> What's left is what's needed to find and delete the cache inodes of an
> existing filesystem:
>
> 1. lookup_free_space_inode(), btrfs_remove_free_space_inode(), and
> btrfs_cleanup_free_space_cache_v1(), which runs on the first
> read-write mount and zeroes cache_generation in the super block.
>
> 2. btrfs_truncate_free_space_cache() and delete_v1_space_cache(), which
> relocation uses to get a cache inode's extents out of a block group.
>
> 3. btrfs_is_free_space_inode(), for the evict and inode update paths.
>
> 4. The on-disk definitions: cache_generation in the super block,
> BTRFS_FREE_SPACE_OBJECTID, and the free space header and entry
> items.
>
> space_cache and space_cache=v1 still fall back to nospace_cache with a
> warning.
The sperblock::space_cache will remain unused and the only valid value
is 0. Repurposing it in the future is possible but we need a long period
in between.
The points listed above for the code that will be still needed seem
minimal. It could be removed eventually leaving only the unmounted
clearing.
I'll add the series as topic branch to linux-next. The mentioned change
to tranaction NOJOIN is simple and no-op in the code so it'll get
updated for the final merge.
next prev parent reply other threads:[~2026-09-09 1:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 1:19 Tal Zussman
2026-09-08 1:19 ` [PATCH 01/15] btrfs: stop enabling the v1 space cache from the on-disk state Tal Zussman
2026-09-08 1:19 ` [PATCH 02/15] btrfs: remove the v1 space cache writeout from the transaction commit Tal Zussman
2026-09-08 1:19 ` [PATCH 03/15] btrfs: remove the free space cache endio workqueue Tal Zussman
2026-09-08 1:19 ` [PATCH 04/15] btrfs: remove the v1 space cache write path Tal Zussman
2026-09-08 1:19 ` [PATCH 05/15] btrfs: drop the transaction handle from the prealloc helpers Tal Zussman
2026-09-08 1:19 ` [PATCH 06/15] btrfs: remove the v1 space cache load path Tal Zussman
2026-09-08 1:19 ` [PATCH 07/15] btrfs: remove btrfs_disk_cache_state Tal Zussman
2026-09-08 1:19 ` [PATCH 08/15] btrfs: remove the SPACE_CACHE mount option flag Tal Zussman
2026-09-08 1:19 ` [PATCH 09/15] btrfs: replace btrfs_set_free_space_cache_v1_active() with a cleanup helper Tal Zussman
2026-09-08 1:19 ` [PATCH 10/15] btrfs: remove the free space cache trimming ranges Tal Zussman
2026-09-08 1:19 ` [PATCH 11/15] btrfs: remove BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE Tal Zussman
2026-09-08 1:19 ` [PATCH 12/15] btrfs: remove the free space inode ordered extent special cases Tal Zussman
2026-09-08 15:42 ` David Sterba
2026-09-08 22:27 ` Tal Zussman
2026-09-08 1:19 ` [PATCH 13/15] btrfs: remove the free space inode special cases from the COW paths Tal Zussman
2026-09-08 1:19 ` [PATCH 14/15] btrfs: stop special-casing free space inodes in the delalloc accounting Tal Zussman
2026-09-08 1:19 ` [PATCH 15/15] btrfs: stop reading free space inodes from the commit root Tal Zussman
2026-09-09 1:08 ` David Sterba [this message]
2026-09-09 4:33 ` [PATCH 00/15] btrfs: remove the v1 space cache Tal Zussman
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=20260909010846.GH9053@suse.cz \
--to=dsterba@suse.cz \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=tz2294@columbia.edu \
--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
all inboxes | Powered by JetHome®