bcachefs: Shrink superblock downgrade table
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 16 Apr 2025 10:48:31 +0000 (06:48 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 May 2025 00:14:20 +0000 (20:14 -0400)
Don't generate entries for versions that won't be able to mount.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/sb-downgrade.c

index badd0e17ada5a0ee016c8394026f2b19ce60d2f3..296c6c9253865df50b886eb55cc8bad93ad4c89a 100644 (file)
@@ -374,6 +374,9 @@ int bch2_sb_downgrade_update(struct bch_fs *c)
                if (BCH_VERSION_MAJOR(src->version) != BCH_VERSION_MAJOR(le16_to_cpu(c->disk_sb.sb->version)))
                        continue;
 
+               if (src->version < c->sb.version_incompat)
+                       continue;
+
                struct bch_sb_field_downgrade_entry *dst;
                unsigned bytes = sizeof(*dst) + sizeof(dst->errors[0]) * src->nr_errors;