summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/util.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-10-22 17:35:35 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:30 -0400
commitb8098f36dd98566790bae019815583363eb877c9 (patch)
tree65e525b5ce9986899b23a6f90d062f72874f6c7a /fs/bcachefs/util.h
parent7f9473d17151408ae0d5fbdbd6089df2f214c2e0 (diff)
downloadlinux-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/bcachefs/util.h')
-rw-r--r--fs/bcachefs/util.h18
1 files changed, 18 insertions, 0 deletions
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)
{