diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-08-21 16:30:14 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:09 -0400 |
commit | a00fd8c535d91c59913756582ed9a4bfbb3c8a95 (patch) | |
tree | 47680ea07a378e780d9afd72a82fe2926bf32a2f /fs/bcachefs/tests.c | |
parent | f84306a5700fba38050ad14ab46ed86aea321aba (diff) | |
download | lwn-a00fd8c535d91c59913756582ed9a4bfbb3c8a95.tar.gz lwn-a00fd8c535d91c59913756582ed9a4bfbb3c8a95.zip |
bcachefs: Comparison function cleanups
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/tests.c')
-rw-r--r-- | fs/bcachefs/tests.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fs/bcachefs/tests.c b/fs/bcachefs/tests.c index f0d28b45a610..dc8abce94ff0 100644 --- a/fs/bcachefs/tests.c +++ b/fs/bcachefs/tests.c @@ -271,6 +271,42 @@ static void test_iterate_slots_extents(struct bch_fs *c, u64 nr) bch2_btree_iter_unlock(&iter); } +/* + * XXX: we really want to make sure we've got a btree with depth > 0 for these + * tests + */ +static void test_peek_end(struct bch_fs *c, u64 nr) +{ + struct btree_iter iter; + struct bkey_s_c k; + + bch2_btree_iter_init(&iter, c, BTREE_ID_DIRENTS, POS_MIN, 0); + + k = bch2_btree_iter_peek(&iter); + BUG_ON(k.k); + + k = bch2_btree_iter_peek(&iter); + BUG_ON(k.k); + + bch2_btree_iter_unlock(&iter); +} + +static void test_peek_end_extents(struct bch_fs *c, u64 nr) +{ + struct btree_iter iter; + struct bkey_s_c k; + + bch2_btree_iter_init(&iter, c, BTREE_ID_EXTENTS, POS_MIN, 0); + + k = bch2_btree_iter_peek(&iter); + BUG_ON(k.k); + + k = bch2_btree_iter_peek(&iter); + BUG_ON(k.k); + + bch2_btree_iter_unlock(&iter); +} + /* extent unit tests */ u64 test_version; @@ -555,6 +591,8 @@ void bch2_btree_perf_test(struct bch_fs *c, const char *testname, perf_test(test_iterate_extents); perf_test(test_iterate_slots); perf_test(test_iterate_slots_extents); + perf_test(test_peek_end); + perf_test(test_peek_end_extents); perf_test(test_extent_overwrite_front); perf_test(test_extent_overwrite_back); |