Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: bkey_copy() is no longer a macro

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+15 -19
+9 -13
fs/bcachefs/bkey.h
··· 92 92 #define bkey_lr_packed(_l, _r) \ 93 93 ((_l)->format + ((_r)->format << 1)) 94 94 95 - #define bkey_copy(_dst, _src) \ 96 - do { \ 97 - BUILD_BUG_ON(!type_is(_dst, struct bkey_i *) && \ 98 - !type_is(_dst, struct bkey_packed *)); \ 99 - BUILD_BUG_ON(!type_is(_src, struct bkey_i *) && \ 100 - !type_is(_src, struct bkey_packed *)); \ 101 - EBUG_ON((u64 *) (_dst) > (u64 *) (_src) && \ 102 - (u64 *) (_dst) < (u64 *) (_src) + \ 103 - ((struct bkey *) (_src))->u64s); \ 104 - \ 105 - memcpy_u64s_small((_dst), (_src), \ 106 - ((struct bkey *) (_src))->u64s); \ 107 - } while (0) 95 + static inline void bkey_p_copy(struct bkey_packed *dst, const struct bkey_packed *src) 96 + { 97 + memcpy_u64s_small(dst, src, src->u64s); 98 + } 99 + 100 + static inline void bkey_copy(struct bkey_i *dst, const struct bkey_i *src) 101 + { 102 + memcpy_u64s_small(dst, src, src->k.u64s); 103 + } 108 104 109 105 struct btree; 110 106
+3 -3
fs/bcachefs/bkey_sort.c
··· 106 106 while ((k = sort_iter_peek(iter))) { 107 107 if (!bkey_deleted(k) && 108 108 !should_drop_next_key(iter)) { 109 - bkey_copy(out, k); 109 + bkey_p_copy(out, k); 110 110 btree_keys_account_key_add(&nr, 0, out); 111 111 out = bkey_p_next(out); 112 112 } ··· 137 137 continue; 138 138 139 139 if (!transform) 140 - bkey_copy(out, in); 140 + bkey_p_copy(out, in); 141 141 else if (bch2_bkey_transform(out_f, out, bkey_packed(in) 142 142 ? in_f : &bch2_bkey_format_current, in)) 143 143 out->format = KEY_FORMAT_LOCAL_BTREE; ··· 191 191 memcpy_u64s_small(out, in, bkeyp_key_u64s(f, in)); 192 192 set_bkeyp_val_u64s(f, out, 0); 193 193 } else { 194 - bkey_copy(out, in); 194 + bkey_p_copy(out, in); 195 195 } 196 196 out->needs_whiteout |= needs_whiteout; 197 197 out = bkey_p_next(out);
+2 -2
fs/bcachefs/btree_io.c
··· 184 184 k = new_whiteouts; 185 185 186 186 while (ptrs != ptrs_end) { 187 - bkey_copy(k, *ptrs); 187 + bkey_p_copy(k, *ptrs); 188 188 k = bkey_p_next(k); 189 189 ptrs++; 190 190 } ··· 260 260 n = bkey_p_next(k); 261 261 262 262 if (!bkey_deleted(k)) { 263 - bkey_copy(out, k); 263 + bkey_p_copy(out, k); 264 264 out = bkey_p_next(out); 265 265 } else { 266 266 BUG_ON(k->needs_whiteout);
+1 -1
fs/bcachefs/btree_update_interior.h
··· 303 303 k.needs_whiteout = true; 304 304 305 305 b->whiteout_u64s += k.u64s; 306 - bkey_copy(unwritten_whiteouts_start(c, b), &k); 306 + bkey_p_copy(unwritten_whiteouts_start(c, b), &k); 307 307 } 308 308 309 309 /*