diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-25 23:01:36 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:48 +0300 |
commit | 321bdc73f3aaba5acb9ed7082cf222444541eb74 (patch) | |
tree | 8d67b0f1b51e3ca46c0d48247c8e40c4ee5ad042 /fs/bcachefs/bkey.h | |
parent | 78c0b75c34209c471616566b3978eac4c1c53e99 (diff) | |
download | linux-321bdc73f3aaba5acb9ed7082cf222444541eb74.tar.xz |
bcachefs: bkey_min(), bkey_max()
Parallel to bpos_min(), bpos_max() - trivial refactoring.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bkey.h')
-rw-r--r-- | fs/bcachefs/bkey.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/bcachefs/bkey.h b/fs/bcachefs/bkey.h index dc2b91bc67f3..28a70ad5a25d 100644 --- a/fs/bcachefs/bkey.h +++ b/fs/bcachefs/bkey.h @@ -182,6 +182,16 @@ static __always_inline int bpos_cmp(struct bpos l, struct bpos r) cmp_int(l.snapshot, r.snapshot); } +static inline struct bpos bpos_min(struct bpos l, struct bpos r) +{ + return bpos_lt(l, r) ? l : r; +} + +static inline struct bpos bpos_max(struct bpos l, struct bpos r) +{ + return bpos_gt(l, r) ? l : r; +} + static __always_inline bool bkey_eq(struct bpos l, struct bpos r) { return !((l.inode ^ r.inode) | @@ -218,14 +228,14 @@ static __always_inline int bkey_cmp(struct bpos l, struct bpos r) cmp_int(l.offset, r.offset); } -static inline struct bpos bpos_min(struct bpos l, struct bpos r) +static inline struct bpos bkey_min(struct bpos l, struct bpos r) { - return bpos_lt(l, r) ? l : r; + return bkey_lt(l, r) ? l : r; } -static inline struct bpos bpos_max(struct bpos l, struct bpos r) +static inline struct bpos bkey_max(struct bpos l, struct bpos r) { - return bpos_gt(l, r) ? l : r; + return bkey_gt(l, r) ? l : r; } void bch2_bpos_swab(struct bpos *); |