diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-10 13:42:26 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:06 -0400 |
commit | 065bd3356ce490ae9454d8b3c98ff298e13d09ac (patch) | |
tree | 968bb0d1b3135ca9d51cdf43c2a963bede5552ab /fs/bcachefs/bcachefs.h | |
parent | 6619d84626ff266721f4c3c24339c60ca8cb12e0 (diff) | |
download | lwn-065bd3356ce490ae9454d8b3c98ff298e13d09ac.tar.gz lwn-065bd3356ce490ae9454d8b3c98ff298e13d09ac.zip |
bcachefs: Version table now lists required recovery passes
Now that we've got forward compatibility sorted out, we should be doing
more frequent version upgrades in the future.
To avoid having to run a full fsck for every version upgrade, this
improves the BCH_METADATA_VERSIONS() table to explicitly specify a
bitmask of recovery passes to run when upgrading to or past a given
version.
This means we can also delete PASS_UPGRADE().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs.h')
-rw-r--r-- | fs/bcachefs/bcachefs.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 88a1782b2a0e..d8c020644f54 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -660,12 +660,11 @@ enum bch_write_ref { #define PASS_FSCK BIT(1) #define PASS_UNCLEAN BIT(2) #define PASS_ALWAYS BIT(3) -#define PASS_UPGRADE(v) ((v) << 4) #define BCH_RECOVERY_PASSES() \ x(alloc_read, PASS_ALWAYS) \ x(stripes_read, PASS_ALWAYS) \ - x(initialize_subvolumes, PASS_UPGRADE(bcachefs_metadata_version_snapshot_2)) \ + x(initialize_subvolumes, 0) \ x(snapshots_read, PASS_ALWAYS) \ x(check_allocations, PASS_FSCK) \ x(set_may_go_rw, PASS_ALWAYS|PASS_SILENT) \ @@ -677,8 +676,8 @@ enum bch_write_ref { x(check_extents_to_backpointers,PASS_FSCK) \ x(check_alloc_to_lru_refs, PASS_FSCK) \ x(fs_freespace_init, PASS_ALWAYS|PASS_SILENT) \ - x(bucket_gens_init, PASS_UPGRADE(bcachefs_metadata_version_bucket_gens)) \ - x(fs_upgrade_for_subvolumes, PASS_UPGRADE(bcachefs_metadata_version_snapshot_2)) \ + x(bucket_gens_init, 0) \ + x(fs_upgrade_for_subvolumes, 0) \ x(check_snapshot_trees, PASS_FSCK) \ x(check_snapshots, PASS_FSCK) \ x(check_subvols, PASS_FSCK) \ @@ -690,7 +689,7 @@ enum bch_write_ref { x(check_root, PASS_FSCK) \ x(check_directory_structure, PASS_FSCK) \ x(check_nlinks, PASS_FSCK) \ - x(fix_reflink_p, PASS_UPGRADE(bcachefs_metadata_version_reflink_p_fix)) \ + x(fix_reflink_p, 0) \ enum bch_recovery_pass { #define x(n, when) BCH_RECOVERY_PASS_##n, @@ -1033,6 +1032,8 @@ struct bch_fs { u64 journal_replay_seq_start; u64 journal_replay_seq_end; enum bch_recovery_pass curr_recovery_pass; + /* bitmap of explicitly enabled recovery passes: */ + u64 recovery_passes_explicit; /* DEBUG JUNK */ struct dentry *fs_debug_dir; @@ -1177,12 +1178,6 @@ static inline bool bch2_dev_exists2(const struct bch_fs *c, unsigned dev) return dev < c->sb.nr_devices && c->devs[dev]; } -static inline bool bch2_version_upgrading_to(const struct bch_fs *c, unsigned new_version) -{ - return c->sb.version_upgrade_complete < new_version && - c->sb.version >= new_version; -} - #define BKEY_PADDED_ONSTACK(key, pad) \ struct { struct bkey_i key; __u64 key ## _pad[pad]; } |