summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/bkey.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-01-18 20:20:24 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:51 -0400
commit33ccd7188e37ad5d9d662e7450610768bc8cc8a9 (patch)
tree174cb0eeae13657ac8247b4e4c388846bbaee0cb /fs/bcachefs/bkey.h
parent6c7585b098c519c157cca4ca1c974321f3903ad4 (diff)
downloadlinux-33ccd7188e37ad5d9d662e7450610768bc8cc8a9.tar.gz
linux-33ccd7188e37ad5d9d662e7450610768bc8cc8a9.tar.bz2
linux-33ccd7188e37ad5d9d662e7450610768bc8cc8a9.zip
bcachefs: Don't allocate stripes at POS_MIN
In the future, stripe index 0 will be a sentinal value. This patch doesn't disallow stripes at POS_MIN yet, leaving that for when we do the on disk format changes. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bkey.h')
-rw-r--r--fs/bcachefs/bkey.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/bkey.h b/fs/bcachefs/bkey.h
index 5ce883ba22dc..f984064f4b5d 100644
--- a/fs/bcachefs/bkey.h
+++ b/fs/bcachefs/bkey.h
@@ -178,6 +178,11 @@ static inline struct bpos bpos_min(struct bpos l, struct bpos r)
return bkey_cmp(l, r) < 0 ? l : r;
}
+static inline struct bpos bpos_max(struct bpos l, struct bpos r)
+{
+ return bkey_cmp(l, r) > 0 ? l : r;
+}
+
void bch2_bpos_swab(struct bpos *);
void bch2_bkey_swab_key(const struct bkey_format *, struct bkey_packed *);