Lines Matching +full:9 +full:k
82 struct bkey_packed *k, *p; in verify_no_dups() local
87 for (p = start, k = bkey_p_next(start); in verify_no_dups()
88 k != end; in verify_no_dups()
89 p = k, k = bkey_p_next(k)) { in verify_no_dups()
91 struct bkey r = bkey_unpack_key(b, k); in verify_no_dups()
100 struct bkey_packed *k; in set_needs_whiteout() local
102 for (k = i->start; k != vstruct_last(i); k = bkey_p_next(k)) in set_needs_whiteout()
103 k->needs_whiteout = v; in set_needs_whiteout()
172 struct bkey_packed *new_whiteouts, **ptrs, **ptrs_end, *k; in bch2_sort_whiteouts() local
183 for (k = unwritten_whiteouts_start(b); in bch2_sort_whiteouts()
184 k != unwritten_whiteouts_end(b); in bch2_sort_whiteouts()
185 k = bkey_p_next(k)) in bch2_sort_whiteouts()
186 *--ptrs = k; in bch2_sort_whiteouts()
190 k = new_whiteouts; in bch2_sort_whiteouts()
193 bkey_p_copy(k, *ptrs); in bch2_sort_whiteouts()
194 k = bkey_p_next(k); in bch2_sort_whiteouts()
230 struct bkey_packed *k, *n, *out, *start, *end; in bch2_drop_whiteouts() local
264 for (k = start; k != end; k = n) { in bch2_drop_whiteouts()
265 n = bkey_p_next(k); in bch2_drop_whiteouts()
267 if (!bkey_deleted(k)) { in bch2_drop_whiteouts()
268 bkey_p_copy(out, k); in bch2_drop_whiteouts()
271 BUG_ON(k->needs_whiteout); in bch2_drop_whiteouts()
516 struct btree *b, struct bset *i, struct bkey_packed *k, in btree_err_msg() argument
534 if (k) in btree_err_msg()
536 (unsigned long)(void *)k - in btree_err_msg()
547 struct bkey_packed *k, in __btree_err() argument
557 btree_err_msg(&out, c, ca, b, i, k, b->written, write); in __btree_err()
613 #define btree_err(type, c, ca, b, i, k, _err_type, msg, ...) \ argument
615 int _ret = __btree_err(type, c, ca, b, i, k, write, have_retry, \
638 struct bkey_packed *k; in bch2_btree_node_drop_keys_outside_node() local
640 for (k = i->start; k != vstruct_last(i); k = bkey_p_next(k)) in bch2_btree_node_drop_keys_outside_node()
641 if (bkey_cmp_left_packed(b, k, &b->data->min_key) >= 0) in bch2_btree_node_drop_keys_outside_node()
644 if (k != i->start) { in bch2_btree_node_drop_keys_outside_node()
645 unsigned shift = (u64 *) k - (u64 *) i->start; in bch2_btree_node_drop_keys_outside_node()
647 memmove_u64s_down(i->start, k, in bch2_btree_node_drop_keys_outside_node()
648 (u64 *) vstruct_end(i) - (u64 *) k); in bch2_btree_node_drop_keys_outside_node()
653 for (k = i->start; k != vstruct_last(i); k = bkey_p_next(k)) in bch2_btree_node_drop_keys_outside_node()
654 if (bkey_cmp_left_packed(b, k, &b->data->max_key) > 0) in bch2_btree_node_drop_keys_outside_node()
657 if (k != vstruct_last(i)) { in bch2_btree_node_drop_keys_outside_node()
658 i->u64s = cpu_to_le16((u64 *) k - (u64 *) i->start); in bch2_btree_node_drop_keys_outside_node()
671 struct bkey_s_c k; in bch2_btree_node_drop_keys_outside_node() local
674 for_each_btree_node_key_unpack(b, k, &iter, &unpacked) { in bch2_btree_node_drop_keys_outside_node()
675 BUG_ON(bpos_lt(k.k->p, b->data->min_key)); in bch2_btree_node_drop_keys_outside_node()
676 BUG_ON(bpos_gt(k.k->p, b->data->max_key)); in bch2_btree_node_drop_keys_outside_node()
756 if (b->key.k.type == KEY_TYPE_btree_ptr_v2) { in validate_bset()
784 if (b->key.k.type == KEY_TYPE_btree_ptr_v2) { in validate_bset()
790 b->data->max_key = b->key.k.p; in validate_bset()
804 btree_err_on(!bpos_eq(bn->max_key, b->key.k.p), in validate_bset()
836 struct bkey_s_c k, in bset_key_validate() argument
839 return __bch2_bkey_validate(c, k, btree_node_type(b), 0) ?: in bset_key_validate()
840 (!updated_range ? bch2_bkey_in_btree_node(c, b, k, 0) : 0) ?: in bset_key_validate()
841 (rw == WRITE ? bch2_bkey_val_validate(c, k, 0) : 0); in bset_key_validate()
845 struct bset *i, struct bkey_packed *k) in bkey_packed_valid() argument
847 if (bkey_p_next(k) > vstruct_last(i)) in bkey_packed_valid()
850 if (k->format > KEY_FORMAT_CURRENT) in bkey_packed_valid()
853 if (!bkeyp_u64s_valid(&b->format, k)) in bkey_packed_valid()
857 struct bkey_s u = __bkey_disassemble(b, k, &tmp); in bkey_packed_valid()
866 struct bkey_packed *k, *prev = NULL; in validate_bset_keys() local
868 bool updated_range = b->key.k.type == KEY_TYPE_btree_ptr_v2 && in validate_bset_keys()
872 for (k = i->start; in validate_bset_keys()
873 k != vstruct_last(i);) { in validate_bset_keys()
878 if (btree_err_on(bkey_p_next(k) > vstruct_last(i), in validate_bset_keys()
880 c, NULL, b, i, k, in validate_bset_keys()
883 i->u64s = cpu_to_le16((u64 *) k - i->_data); in validate_bset_keys()
887 if (btree_err_on(k->format > KEY_FORMAT_CURRENT, in validate_bset_keys()
889 c, NULL, b, i, k, in validate_bset_keys()
891 "invalid bkey format %u", k->format)) in validate_bset_keys()
894 if (btree_err_on(!bkeyp_u64s_valid(&b->format, k), in validate_bset_keys()
896 c, NULL, b, i, k, in validate_bset_keys()
898 "bad k->u64s %u (min %u max %zu)", k->u64s, in validate_bset_keys()
899 bkeyp_key_u64s(&b->format, k), in validate_bset_keys()
900 U8_MAX - BKEY_U64s + bkeyp_key_u64s(&b->format, k))) in validate_bset_keys()
906 &b->format, k); in validate_bset_keys()
908 u = __bkey_disassemble(b, k, &tmp); in validate_bset_keys()
919 &b->format, k); in validate_bset_keys()
921 if (prev && bkey_iter_cmp(b, prev, k) > 0) { in validate_bset_keys()
928 bch2_bkey_to_text(&buf, u.k); in validate_bset_keys()
931 c, NULL, b, i, k, in validate_bset_keys()
937 prev = k; in validate_bset_keys()
938 k = bkey_p_next(k); in validate_bset_keys()
941 next_good_key = k->u64s; in validate_bset_keys()
951 if (!bkey_packed_valid(c, b, i, (void *) ((u64 *) k + next_good_key))) { in validate_bset_keys()
953 next_good_key < (u64 *) vstruct_last(i) - (u64 *) k; in validate_bset_keys()
955 if (bkey_packed_valid(c, b, i, (void *) ((u64 *) k + next_good_key))) in validate_bset_keys()
963 next_good_key = (u64 *) vstruct_last(i) - (u64 *) k; in validate_bset_keys()
967 memmove_u64s_down(k, bkey_p_next(k), (u64 *) vstruct_end(i) - (u64 *) k); in validate_bset_keys()
980 struct bkey_packed *k; in bch2_btree_node_read_done() local
983 bool updated_range = b->key.k.type == KEY_TYPE_btree_ptr_v2 && in bch2_btree_node_read_done()
1012 if (b->key.k.type == KEY_TYPE_btree_ptr_v2) { in bch2_btree_node_read_done()
1054 nonce = btree_nonce(i, b->written << 9); in bch2_btree_node_read_done()
1070 ret = bset_encrypt(c, i, b->written << 9); in bch2_btree_node_read_done()
1096 nonce = btree_nonce(i, b->written << 9); in bch2_btree_node_read_done()
1111 ret = bset_encrypt(c, i, b->written << 9); in bch2_btree_node_read_done()
1215 for (k = i->start; k != vstruct_last(i);) { in bch2_btree_node_read_done()
1217 struct bkey_s u = __bkey_disassemble(b, k, &tmp); in bch2_btree_node_read_done()
1222 !bversion_cmp(u.k->bversion, MAX_VERSION))) { in bch2_btree_node_read_done()
1223 btree_keys_account_key_drop(&b->nr, 0, k); in bch2_btree_node_read_done()
1225 i->u64s = cpu_to_le16(le16_to_cpu(i->u64s) - k->u64s); in bch2_btree_node_read_done()
1226 memmove_u64s_down(k, bkey_p_next(k), in bch2_btree_node_read_done()
1227 (u64 *) vstruct_end(i) - (u64 *) k); in bch2_btree_node_read_done()
1234 if (u.k->type == KEY_TYPE_btree_ptr_v2) { in bch2_btree_node_read_done()
1240 k = bkey_p_next(k); in bch2_btree_node_read_done()
1346 bch2_bpos_to_text(&buf, b->key.k.p); in btree_node_read_work()
1396 bne = data + (offset << 9); in btree_node_sectors_written()
1415 bne = data + (offset << 9); in btree_node_has_extra_bsets()
1435 __le64 seq = b->key.k.type == KEY_TYPE_btree_ptr_v2 in CLOSURE_CALLBACK()
1466 btree_err_on(memcmp(ra->buf[best], ra->buf[i], written << 9), in CLOSURE_CALLBACK()
1495 bne = ra->buf[i] + (offset << 9); in CLOSURE_CALLBACK()
1509 bne = ra->buf[i] + (offset << 9); in CLOSURE_CALLBACK()
1577 struct bkey_s_c k = bkey_i_to_s_c(&b->key); in btree_node_read_all_replicas() local
1578 struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); in btree_node_read_all_replicas()
1591 ra->nr = bch2_bkey_nr_ptrs(k); in btree_node_read_all_replicas()
1603 bkey_for_each_ptr_decode(k.k, ptrs, pick, entry) { in btree_node_read_all_replicas()
1723 const struct bkey_i *k, unsigned level) in __bch2_btree_root_read() argument
1742 bkey_copy(&b->key, k); in __bch2_btree_root_read()
1769 const struct bkey_i *k, unsigned level) in bch2_btree_root_read() argument
1771 return bch2_trans_run(c, __bch2_btree_root_read(trans, id, k, level)); in bch2_btree_root_read()
1955 BKEY_PADDED_ONSTACK(k, BKEY_BTREE_PTR_VAL_U64s_MAX) tmp; in btree_write_submit()
1957 bkey_copy(&tmp.k, &wbio->key); in btree_write_submit()
1959 bkey_for_each_ptr(bch2_bkey_ptrs(bkey_i_to_s(&tmp.k)), ptr) in btree_write_submit()
1963 &tmp.k, false); in btree_write_submit()
2109 sectors_to_write = round_up(bytes_to_write, block_bytes(c)) >> 9; in __bch2_btree_node_write()
2112 b->key.k.type == KEY_TYPE_btree_ptr_v2) in __bch2_btree_node_write()
2116 (sectors_to_write << 9) - bytes_to_write); in __bch2_btree_node_write()
2138 ret = bset_encrypt(c, i, b->written << 9); in __bch2_btree_node_write()
2143 nonce = btree_nonce(i, b->written << 9); in __bch2_btree_node_write()
2180 buf_pages(data, sectors_to_write << 9), in __bch2_btree_node_write()
2195 bch2_bio_map(&wbio->wbio.bio, data, sectors_to_write << 9); in __bch2_btree_node_write()
2201 if (wbio->key.k.type == KEY_TYPE_btree_ptr_v2) in __bch2_btree_node_write()