diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-10-22 17:35:35 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:30 -0400 |
commit | b8098f36dd98566790bae019815583363eb877c9 (patch) | |
tree | 65e525b5ce9986899b23a6f90d062f72874f6c7a /fs | |
parent | 7f9473d17151408ae0d5fbdbd6089df2f214c2e0 (diff) | |
download | linux-stable-b8098f36dd98566790bae019815583363eb877c9.tar.gz linux-stable-b8098f36dd98566790bae019815583363eb877c9.tar.bz2 linux-stable-b8098f36dd98566790bae019815583363eb877c9.zip |
bcachefs: Don't use rep movsq for small memcopies
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/bkey.h | 4 | ||||
-rw-r--r-- | fs/bcachefs/extents.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/util.h | 18 |
3 files changed, 22 insertions, 4 deletions
diff --git a/fs/bcachefs/bkey.h b/fs/bcachefs/bkey.h index 321fe6fe0b55..cb2702707c2a 100644 --- a/fs/bcachefs/bkey.h +++ b/fs/bcachefs/bkey.h @@ -95,8 +95,8 @@ do { \ (u64 *) (_dst) < (u64 *) (_src) + \ ((struct bkey *) (_src))->u64s); \ \ - __memmove_u64s_down((_dst), (_src), \ - ((struct bkey *) (_src))->u64s); \ + memcpy_u64s_small((_dst), (_src), \ + ((struct bkey *) (_src))->u64s); \ } while (0) struct btree; diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c index 20a2eeed98cd..b427bc1f0f9c 100644 --- a/fs/bcachefs/extents.c +++ b/fs/bcachefs/extents.c @@ -1457,8 +1457,8 @@ 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), - dst, (u64 *) end - (u64 *) dst); + 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)); } diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 5f0a3de91ae3..965b6dd73bfa 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -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) { |