diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-24 11:12:22 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:47 +0300 |
commit | e88a75ebe86c1df42f0ca9ab6e8fa50db26e7cef (patch) | |
tree | 3b8608b0ae6e06d405bf6ef63e098416c68830db /fs/bcachefs/debug.c | |
parent | e15382125948523cd5c887c5fe4fa4303e9a9dc1 (diff) | |
download | linux-e88a75ebe86c1df42f0ca9ab6e8fa50db26e7cef.tar.xz |
bcachefs: New bpos_cmp(), bkey_cmp() replacements
This patch introduces
- bpos_eq()
- bpos_lt()
- bpos_le()
- bpos_gt()
- bpos_ge()
and equivalent replacements for bkey_cmp().
Looking at the generated assembly these could probably be improved
further, but we already see a significant code size improvement with
this patch.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/debug.c')
-rw-r--r-- | fs/bcachefs/debug.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c index 16be8d3db2ad..d3e769b1eb3e 100644 --- a/fs/bcachefs/debug.c +++ b/fs/bcachefs/debug.c @@ -306,7 +306,7 @@ static ssize_t bch2_read_btree_formats(struct file *file, char __user *buf, if (ret) return ret; - if (!bpos_cmp(SPOS_MAX, i->from)) + if (bpos_eq(SPOS_MAX, i->from)) return i->ret; bch2_trans_init(&trans, i->c, 0, 0); @@ -317,7 +317,7 @@ static ssize_t bch2_read_btree_formats(struct file *file, char __user *buf, break; bch2_btree_node_to_text(&i->buf, i->c, b); - i->from = bpos_cmp(SPOS_MAX, b->key.k.p) + i->from = !bpos_eq(SPOS_MAX, b->key.k.p) ? bpos_successor(b->key.k.p) : b->key.k.p; } @@ -368,7 +368,7 @@ static ssize_t bch2_read_bfloat_failed(struct file *file, char __user *buf, if (ret) break; - if (bpos_cmp(l->b->key.k.p, i->prev_node) > 0) { + if (bpos_gt(l->b->key.k.p, i->prev_node)) { bch2_btree_node_to_text(&i->buf, i->c, l->b); i->prev_node = l->b->key.k.p; } |