public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Snapshot deletion improvements
@ 2025-05-02 19:59 Kent Overstreet
  2025-05-02 19:59 ` [PATCH 1/8] bcachefs: snapshot delete progress indicator Kent Overstreet
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Kent Overstreet @ 2025-05-02 19:59 UTC (permalink / raw)
  To: linux-bcachefs, linux-kernel; +Cc: Kent Overstreet

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-05-02 20:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 19:59 [PATCH 0/8] Snapshot deletion improvements Kent Overstreet
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox