From: Kent Overstreet <kent.overstreet@linux.dev>
To: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Subject: [PATCH 0/8] Snapshot deletion improvements
Date: Fri, 2 May 2025 15:59:52 -0400 [thread overview]
Message-ID: <20250502200002.1309862-1-kent.overstreet@linux.dev> (raw)
Snapshot deletion performance has been reported to be an issue, so this
patch series should address that.
The important optimization relies on the fact that if an
extent/dirent/xattr exists, a version of that inode must exist in that
specific snapshot. We can make use of that to avoid a lot of scanning.
Previously only fsck relied on this, so it would spit out a warning and
correct the issue in its in memory data structures if this occurred.
Now, it's turned into a proper fsck_err() with on-disk repair if
detected.
We also want some additional safety with this: if snapshot deletion ever
screws up and doesn't delete all the keys it was supposed to, we want to
be able to automatically repair.
So there's a new on disk format version with an incompatible (i.e. must
be expliticly enabled) feature, where we never delete snapshot keys - we
just mark them as deleted.
This allows fsck to differentiate between "key for deleted snapshot, I
know how to repair this" vs. "key for missing snapshot, we're not sure
what happened and someone should probably take a look".
And snapshot deletion status is now present in sysfs, currently with
btree and position in that btree. We do have per-snapshot-id accounting,
so it might be possible to turn that into a proper progress indicator
later.
Kent Overstreet (8):
bcachefs: snapshot delete progress indicator
bcachefs: Add comments for inode snapshot requirements
bcachefs: kill inode_walker_entry.snapshot
bcachefs: BCH_FSCK_ERR_snapshot_key_missing_inode_snapshot
bcachefs: Skip unrelated snapshot trees in snapshot deletion
bcachefs: BCH_SNAPSHOT_DELETED -> BCH_SNAPSHOT_WILL_DELETE
bcachefs: bcachefs_metadata_version_snapshot_deletion_v2
bcachefs: delete_dead_snapshot_keys_v2()
fs/bcachefs/bcachefs.h | 3 +-
fs/bcachefs/bcachefs_format.h | 3 +-
fs/bcachefs/fsck.c | 78 ++++---
fs/bcachefs/io_write.c | 6 +
fs/bcachefs/sb-errors_format.h | 4 +-
fs/bcachefs/snapshot.c | 389 +++++++++++++++++++++++++--------
fs/bcachefs/snapshot.h | 32 ++-
fs/bcachefs/snapshot_format.h | 4 +-
fs/bcachefs/snapshot_types.h | 56 +++++
fs/bcachefs/subvolume.c | 2 -
fs/bcachefs/subvolume.h | 3 -
fs/bcachefs/subvolume_types.h | 27 ---
fs/bcachefs/super.c | 1 +
fs/bcachefs/sysfs.c | 5 +
fs/bcachefs/xattr.c | 5 +
15 files changed, 445 insertions(+), 173 deletions(-)
create mode 100644 fs/bcachefs/snapshot_types.h
--
2.49.0
next reply other threads:[~2025-05-02 20:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 19:59 Kent Overstreet [this message]
2025-05-02 19:59 ` [PATCH 1/8] bcachefs: snapshot delete progress indicator Kent Overstreet
2025-05-02 19:59 ` [PATCH 2/8] bcachefs: Add comments for inode snapshot requirements Kent Overstreet
2025-05-02 19:59 ` [PATCH 3/8] bcachefs: kill inode_walker_entry.snapshot Kent Overstreet
2025-05-02 19:59 ` [PATCH 4/8] bcachefs: BCH_FSCK_ERR_snapshot_key_missing_inode_snapshot Kent Overstreet
2025-05-02 19:59 ` [PATCH 5/8] bcachefs: Skip unrelated snapshot trees in snapshot deletion Kent Overstreet
2025-05-02 19:59 ` [PATCH 6/8] bcachefs: BCH_SNAPSHOT_DELETED -> BCH_SNAPSHOT_WILL_DELETE Kent Overstreet
2025-05-02 19:59 ` [PATCH 7/8] bcachefs: bcachefs_metadata_version_snapshot_deletion_v2 Kent Overstreet
2025-05-02 20:00 ` [PATCH 8/8] bcachefs: delete_dead_snapshot_keys_v2() Kent Overstreet
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=20250502200002.1309862-1-kent.overstreet@linux.dev \
--to=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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