bcachefs: bcachefs_metadata_version_deleted_inodes
PATCH 1/1 bcachefs: bcachefs_metadata_version_deleted_inodes
Add a new bitset btree for inodes pending deletion; this means we no longer have to scan the full inodes btree after an unclean shutdown.
Specifically, this adds:
- a trigger to update the deleted_inodes btree based on changes to the inodes btree
- a new recovery pass
- and check_inodes is now only a fsck pass.
Signed-off-by Kent Overstreet <[email protected]>
--- fs/bcachefs/bcachefs.h | 4 +- fs/bcachefs/bcachefs_format.h | 8 ++- fs/bcachefs/inode.c | 113 ++++++++++++++++++++++++++++++++++ fs/bcachefs/inode.h | 1 + 4 files changed, 123 insertions(+), 3 deletions(-)
fs/bcachefs/bcachefs.h +3 -1
@@ -452,6 +452,7 @@ enum gc_phase { GC_PHASE_BTREE_backpointers, GC_PHASE_BTREE_bucket_gens, GC_PHASE_BTREE_snapshot_trees, + GC_PHASE_BTREE_deleted_inodes, GC_PHASE_PENDING_DELETE, };
@@ -682,13 +683,14 @@ enum bch_write_ref { x(check_subvols, PASS_FSCK) \ x(delete_dead_snapshots, PASS_FSCK|PASS_UNCLEAN) \ x(fs_upgrade_for_subvolumes, 0) \ - x(check_inodes, PASS_FSCK|PASS_UNCLEAN) \ + x(check_inodes, PASS_FSCK) \ x(check_extents, PASS_FSCK) \ x(check_dirents, PASS_FSCK) \ x(check_xattrs, PASS_FSCK) \ x(check_root, PASS_FSCK) \ x(check_directory_structure, PASS_FSCK) \ x(check_nlinks, PASS_FSCK) \ + x(delete_dead_inodes, PASS_FSCK|PASS_UNCLEAN) \ x(fix_reflink_p, 0) \enum bch_recovery_pass {
fs/bcachefs/bcachefs_format.h +6 -2
@@ -1629,7 +1629,9 @@ struct bch_sb_field_journal_seq_blacklist {x (major_minor,BCH_VERSION (1 ,0 ), \ 0) \x (snapshot_skiplists,BCH_VERSION (1 ,1 ), \ - BIT_ULL(BCH_RECOVERY_PASS_check_snapshots)) + BIT_ULL(BCH_RECOVERY_PASS_check_snapshots)) \ +x (deleted_inodes,BCH_VERSION (1 ,2 ), \ + BIT_ULL(BCH_RECOVERY_PASS_check_inodes))enum bcachefs_metadata_version { bcachefs_metadata_version_min =9 ,
@@ -2251,7 +2253,9 @@ enum btree_id_flags {x (bucket_gens,14 ,0 , \ BIT_ULL(KEY_TYPE_bucket_gens)) \x (snapshot_trees,15 ,0 , \ - BIT_ULL(KEY_TYPE_snapshot_tree)) + BIT_ULL(KEY_TYPE_snapshot_tree)) \ +x (deleted_inodes,16 ,BTREE_ID_SNAPSHOTS , \ + BIT_ULL(KEY_TYPE_set))enum btree_id {#define x(name, nr, ...) BTREE_ID_##name = nr,
fs/bcachefs/inode.c +113 -0
140 lines not on this page · raw message
fs/bcachefs/inode.h +1 -0
@@ -199,5 +199,6 @@ void bch2_inode_opts_get(struct bch_io_opts *, struct bch_fs *, struct bch_inode_unpacked *);int bch2_inode_rm_snapshot (struct btree_trans *,u64 ,u32 ); +int bch2_delete_dead_inodes (struct bch_fs *);#endif /* _BCACHEFS_INODE_H */
Signature · 1 line
2.40.1