1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_BBPOS_H
3 #define _BCACHEFS_BBPOS_H
5 #include "bbpos_types.h"
6 #include "bkey_methods.h"
7 #include "btree_cache.h"
9 static inline int bbpos_cmp(struct bbpos l, struct bbpos r)
11 return cmp_int(l.btree, r.btree) ?: bpos_cmp(l.pos, r.pos);
14 static inline struct bbpos bbpos_successor(struct bbpos pos)
16 if (bpos_cmp(pos.pos, SPOS_MAX)) {
17 pos.pos = bpos_successor(pos.pos);
21 if (pos.btree != BTREE_ID_NR) {
30 static inline void bch2_bbpos_to_text(struct printbuf *out, struct bbpos pos)
32 prt_str(out, bch2_btree_id_str(pos.btree));
34 bch2_bpos_to_text(out, pos.pos);
37 #endif /* _BCACHEFS_BBPOS_H */