Commit b8098f36 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Don't use rep movsq for small memcopies

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 7f9473d1
......@@ -95,7 +95,7 @@ do { \
(u64 *) (_dst) < (u64 *) (_src) + \
((struct bkey *) (_src))->u64s); \
\
__memmove_u64s_down((_dst), (_src), \
memcpy_u64s_small((_dst), (_src), \
((struct bkey *) (_src))->u64s); \
} while (0)
......
......@@ -1457,7 +1457,7 @@ static inline void __extent_entry_insert(struct bkey_i *k,
{
union bch_extent_entry *end = bkey_val_end(bkey_i_to_s(k));
memmove_u64s_up((u64 *) dst + extent_entry_u64s(new),
memmove_u64s_up_small((u64 *) dst + extent_entry_u64s(new),
dst, (u64 *) end - (u64 *) dst);
k->k.u64s += extent_entry_u64s(new);
memcpy_u64s_small(dst, new, extent_entry_u64s(new));
......
......@@ -593,6 +593,24 @@ static inline void memmove_u64s_down(void *dst, const void *src,
__memmove_u64s_down(dst, src, u64s);
}
static inline void __memmove_u64s_up_small(void *_dst, const void *_src,
unsigned u64s)
{
u64 *dst = (u64 *) _dst + u64s;
u64 *src = (u64 *) _src + u64s;
while (u64s--)
*--dst = *--src;
}
static inline void memmove_u64s_up_small(void *dst, const void *src,
unsigned u64s)
{
EBUG_ON(dst < src);
__memmove_u64s_up_small(dst, src, u64s);
}
static inline void __memmove_u64s_up(void *_dst, const void *_src,
unsigned u64s)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment