summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/bcachefs.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-28 19:59:56 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:06 -0400
commit24964e1c5c89e00ca55909ab24ce8d28e2b46406 (patch)
tree6ca19695501bb5947532e799c319c570e653f16e /fs/bcachefs/bcachefs.h
parent7c50140fce00120b1dcf674759393267689ca2d8 (diff)
downloadlinux-stable-24964e1c5c89e00ca55909ab24ce8d28e2b46406.tar.gz
linux-stable-24964e1c5c89e00ca55909ab24ce8d28e2b46406.tar.bz2
linux-stable-24964e1c5c89e00ca55909ab24ce8d28e2b46406.zip
bcachefs: BCH_SB_VERSION_UPGRADE_COMPLETE()
Version upgrades are not atomic operations: when we do a version upgrade we need to update the superblock before we start using new features, and then when the upgrade completes we need to update the superblock again. This adds a new superblock field so we can detect and handle incomplete version upgrades. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs.h')
-rw-r--r--fs/bcachefs/bcachefs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index a8488d4e18e8..d7f030aa3039 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -712,6 +712,7 @@ struct bch_fs {
u16 version;
u16 version_min;
+ u16 version_upgrade_complete;
u8 nr_devices;
u8 clean;
@@ -1134,6 +1135,12 @@ 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]; }