* [LTP] [PATCH] Use memset() to fill buffers in diotest
@ 2024-02-27 1:37 Sergey Ulanov via ltp
2024-02-27 10:35 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Ulanov via ltp @ 2024-02-27 1:37 UTC (permalink / raw)
To: ltp; +Cc: Sergey Ulanov
Previously fillbuf() was calling strncpy() for every byte in the buffer,
which is rather inefficient and was slowing down the tests.
Signed-off-by: Sergey Ulanov <sergeyu@google.com>
---
testcases/kernel/io/direct_io/diotest_routines.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/testcases/kernel/io/direct_io/diotest_routines.c b/testcases/kernel/io/direct_io/diotest_routines.c
index fe03630ef..793572c37 100644
--- a/testcases/kernel/io/direct_io/diotest_routines.c
+++ b/testcases/kernel/io/direct_io/diotest_routines.c
@@ -55,11 +55,7 @@
*/
void fillbuf(char *buf, int count, char value)
{
- while (count > 0) {
- strncpy(buf, &value, 1);
- buf++;
- count = count - 1;
- }
+ memset(buf, value, count);
}
void vfillbuf(struct iovec *iv, int vcnt, char value)
--
2.44.0.rc1.240.g4c46232300-goog
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] Use memset() to fill buffers in diotest
2024-02-27 1:37 [LTP] [PATCH] Use memset() to fill buffers in diotest Sergey Ulanov via ltp
@ 2024-02-27 10:35 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2024-02-27 10:35 UTC (permalink / raw)
To: Sergey Ulanov; +Cc: ltp
Hi!
Good catch, applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-27 10:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 1:37 [LTP] [PATCH] Use memset() to fill buffers in diotest Sergey Ulanov via ltp
2024-02-27 10:35 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox