syscalls/cachestat01: minor improvements
cover syscalls/cachestat01: minor improvements
A few small cleanups and a fix for an unchecked fsync() in cachestat01.
Avinesh Kumar (4):
syscalls/cachestat01: Remove redundant memset() on cachestat buffer syscalls/cachestat01: Drop stray newline in tst_res() message syscalls/cachestat01: Add spaces around '<<' operator syscalls/cachestat01: Use SAFE_FSYNC() instead of fsync()
testcases/kernel/syscalls/cachestat/cachestat01.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/4 syscalls/cachestat01: Remove redundant memset() on cachestat buffer
From: Avinesh Kumar <[email protected]>
--- testcases/kernel/syscalls/cachestat/cachestat01.c | 2 -- 1 file changed, 2 deletions(-)
testcases/kernel/syscalls/cachestat/cachestat01.c +0 -2
@@ -36,8 +36,6 @@ static void test_cached_pages(const unsigned int use_sync, const int num_pages)tst_res (TINFO ,"%s file synchronization" , use_sync ?"Enable" :"Disable" );tst_res (TINFO ,"Number of pages: %d" , num_pages); -memset (cs,0 ,sizeof (struct cachestat )); - fd =SAFE_OPEN (FILENAME ,O_RDWR |O_CREAT ,0600 );for (int i =0 ; i < num_pages; i++)
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] syscalls/cachestat01: Remove redundant memset() on cachestat buffer
Hi Avinesh,
Quoted 1 line · Avinesh Kumar
syscalls/cachestat01: Remove redundant
memset()on cachestat buffer
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/4 syscalls/cachestat01: Drop stray newline in tst_res() message
In reply to Avinesh Kumar via ltpFrom: Avinesh Kumar <[email protected]>
tst_res() appends its own newline, so this prints a blank line.
tst_test.c:1303: TINFO: Mounting /dev/loop0 to /var/tmp/LTP_cacmJmF9g/mntpoint fstyp=ext2 flags=0 cachestat01.c:78: TINFO: Limiting num_shift to 3
cachestat01.c:36: TINFO: Disable file synchronization cachestat01.c:37: TINFO: Number of pages: 1
--- testcases/kernel/syscalls/cachestat/cachestat01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/cachestat/cachestat01.c +1 -1
@@ -73,7 +73,7 @@ static void setup(void)for (num_shift =0 ; num_shift <=15 ; num_shift++) {if ((1lu <<num_shift) * page_size /1024 >= tst_device->size) { -tst_res (TINFO ,"Limiting num_shift to %i\n" , num_shift); +tst_res (TINFO ,"Limiting num_shift to %i" , num_shift);break ; } }
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 3/4 syscalls/cachestat01: Add spaces around '<<' operator
In reply to Avinesh Kumar via ltpFrom: Avinesh Kumar <[email protected]>
$ make check-cachestat01 CHECK testcases/kernel/syscalls/cachestat/cachestat01.c cachestat01.c:75: CHECK: spaces preferred around that '<<' (ctx:VxV)
--- testcases/kernel/syscalls/cachestat/cachestat01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/cachestat/cachestat01.c +1 -1
@@ -72,7 +72,7 @@ static void setup(void) page_size = (int )sysconf (_SC_PAGESIZE);for (num_shift =0 ; num_shift <=15 ; num_shift++) { -if ((1lu <<num_shift) * page_size /1024 >= tst_device->size) { +if ((1lu << num_shift) * page_size /1024 >= tst_device->size) {tst_res (TINFO ,"Limiting num_shift to %i" , num_shift);break ; }
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 4/4 syscalls/cachestat01: Use SAFE_FSYNC() instead of fsync()
In reply to Avinesh Kumar via ltpFrom: Avinesh Kumar <[email protected]>
Success of fsync() is not checked. Use SAFE_FSYNC() instead so that a failed synchronization is reported instead of being silently ignored.
--- testcases/kernel/syscalls/cachestat/cachestat01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/cachestat/cachestat01.c +1 -1
@@ -42,7 +42,7 @@ static void test_cached_pages(const unsigned int use_sync, const int num_pages)SAFE_WRITE (0 , fd, page_data, page_size);if (use_sync) -fsync (fd); +SAFE_FSYNC (fd); cs_range->off =0 ; cs_range->len = page_size * num_pages;
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 4/4] syscalls/cachestat01: Use SAFE_FSYNC() instead of fsync()
Hi Avinesh,
thanks for the cleanup, merged!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp