Use memset() to fill buffers in diotest
PATCH 1/1 Use memset() to fill buffers in diotest
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 <[email protected]>
--- testcases/kernel/io/direct_io/diotest_routines.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
testcases/kernel/io/direct_io/diotest_routines.c +1 -5
@@ -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)
Signature · 5 lines
2.44.0.rc1.240.g4c46232300-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Good catch, applied, thanks.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp