syscalls/fallocate04: add new fallocate() test
PATCH v4 1/1 syscalls/fallocate04: add new fallocate() test
This is a new functional test of fallocate() syscall with the focus on FALLOC_FL_ZERO_RANGE (since Linux 3.15) and FALLOC_FL_COLLAPSE_RANGE (since Linux 3.15) modes.
Steps of test-cases:
* allocate a file with specified size;
* make a hole in the middle of the file with FALLOC_FL_PUNCH_HOLE;
* fill the hole and adjacent space with FALLOC_FL_ZERO_RANGE;
* remove a block from a file with FALLOC_FL_COLLAPSE_RANGE
---
v4: corrected Linux version for FALLOC_FL_ZERO_RANGE
removed second Linux version check in test04()
added 'EOPNOTSUPP' check for initial fallocate()
v3: correctly indented second line in if blocks and tst_resm
v2: replaced lseek, read, write, etc. with LTP safe macros
moved FALLOC_FL_* macros to fallocate.h
removed FALLOC_FL_KEEP_SIZE from fallocate03 (it is now in fallocate.h) made one more test-case (split setup())
runtest/syscalls | 1 + testcases/kernel/syscalls/.gitignore | 1 + testcases/kernel/syscalls/fallocate/fallocate.h | 20 ++ testcases/kernel/syscalls/fallocate/fallocate03.c | 1 - testcases/kernel/syscalls/fallocate/fallocate04.c | 273 +++++++++++++++++++++ 5 files changed, 295 insertions(+), 1 deletions(-) create mode 100644 testcases/kernel/syscalls/fallocate/fallocate04.c
runtest/syscalls +1 -0
@@ -154,6 +154,7 @@ faccessat01 faccessat01 fallocate01 fallocate01 fallocate02 fallocate02 fallocate03 fallocate03 +fallocate04 fallocate04 #posix_fadvise test cases posix_fadvise01 posix_fadvise01
testcases/kernel/syscalls/.gitignore +1 -0
@@ -135,6 +135,7 @@ /fallocate/fallocate01 /fallocate/fallocate02 /fallocate/fallocate03 +/fallocate/fallocate04 /fchdir/fchdir01 /fchdir/fchdir02 /fchdir/fchdir03
testcases/kernel/syscalls/fallocate/fallocate.h +20 -0
@@ -27,6 +27,26 @@#include "lapi/abisize.h" #include "linux_syscall_numbers.h" +#ifndef SEEK_HOLE +#define SEEK_HOLE 4 +#endif + +#ifndef FALLOC_FL_KEEP_SIZE +#define FALLOC_FL_KEEP_SIZE 0x01 +#endif + +#ifndef FALLOC_FL_PUNCH_HOLE +#define FALLOC_FL_PUNCH_HOLE 0x02 +#endif + +#ifndef FALLOC_FL_COLLAPSE_RANGE +#define FALLOC_FL_COLLAPSE_RANGE 0x08 +#endif + +#ifndef FALLOC_FL_ZERO_RANGE +#define FALLOC_FL_ZERO_RANGE 0x10 +#endif +#if !defined(HAVE_FALLOCATE )static inline long fallocate (int fd,int mode,loff_t offset,loff_t len) {
testcases/kernel/syscalls/fallocate/fallocate03.c +0 -1
@@ -101,7 +101,6 @@#define BLOCKS_WRITTEN 12#define HOLE_SIZE_IN_BLOCKS 12#define DEFAULT_MODE 0 -#define FALLOC_FL_KEEP_SIZE 1 //Need to be removed once the glibce support is provided#define TRUE 0void get_blocksize (int );
testcases/kernel/syscalls/fallocate/fallocate04.c new file +273 -0
273 lines not on this page · raw message
Signature · 13 lines
1.7.1 ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
----- Original Message -----
Quoted 27 lines
From: "Alexey Kodanev" <[email protected]>
To: [email protected]
Cc: "vasily isaenko" <[email protected]>
Sent: Tuesday, 21 April, 2015 3:05:07 PM
Subject: [LTP] [PATCH v4] syscalls/fallocate04: add newfallocate()testThis is a new functional test of
fallocate()syscall with the focus onFALLOC_FL_ZERO_RANGE(since Linux 3.15) andFALLOC_FL_COLLAPSE_RANGE(since Linux 3.15) modes.Steps of test-cases:
* allocate a file with specified size;
* make a hole in the middle of the file withFALLOC_FL_PUNCH_HOLE;
* fill the hole and adjacent space withFALLOC_FL_ZERO_RANGE;
* remove a block from a file withFALLOC_FL_COLLAPSE_RANGESigned-off-by Alexey Kodanev <[email protected]>---
v4: corrected Linux version forFALLOC_FL_ZERO_RANGE
removed second Linux version check intest04()
added 'EOPNOTSUPP' check for initialfallocate()
v3: correctly indented second line in if blocks andtst_resm
v2: replaced lseek, read, write, etc. with LTP safe macros
moved FALLOC_FL_* macros tofallocate.h
removedFALLOC_FL_KEEP_SIZEfrom fallocate03 (it is now infallocate.h) made one more test-case (splitsetup())
Quoted 9 lines
runtest/syscalls | 1 + testcases/kernel/syscalls/.gitignore | 1 + testcases/kernel/syscalls/fallocate/fallocate.h | 20 ++ testcases/kernel/syscalls/fallocate/fallocate03.c | 1 - testcases/kernel/syscalls/fallocate/fallocate04.c | 273 +++++++++++++++++++++ 5 files changed, 295 insertions(+), 1 deletions(-) create mode 100644 testcases/kernel/syscalls/fallocate/fallocate04.c
v4 looks good, older kernels now end with TCONF. ACK
Regards,
Jan
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 14 lines
testcases/kernel/syscalls/fallocate/fallocate04.c new file +8
-0@@ -0,0 +1,273 @@ +/* +* Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +*
testcases/kernel/syscalls/fallocate/fallocate04.c line 18
Quoted 10 lines
testcases/kernel/syscalls/fallocate/fallocate04.c new file +10
-0+* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* Author: Alexey Kodanev <[email protected]> +*/
What about adding a short comment here, with high level description of the testcase? It's a bit easier to dive in the code if you know the big picture beforehand.
testcases/kernel/syscalls/fallocate/fallocate04.c line 27
Quoted 8 lines
testcases/kernel/syscalls/fallocate/fallocate04.c new file +8
-0+#define _GNU_SOURCE + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h>
The rest looks fine. I may be tempted not to use tst_brkm(TCONF, ...) in the test functions and do tst_resm(TCONF, ...); return; instead, but that is minor thing.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi!
Quoted 6 lines
Quoted 3 lines
The rest looks fine. I may be tempted not to use
tst_brkm(TCONF, ...)in the test functions and dotst_resm(TCONF, ...); return; instead, but that is minor thing.It could be better to do so if each test-case (step) was independent, but each one (except the first) relies on the work done by the previous one.
Ah, right. Then we have no choice but to exit the test.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 fallocate04: another check if SEEK_HOLE is not supported
In reply to Alexey KodanevSEEK_HOLE is only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supported SEEK_HOLE.
--- testcases/kernel/syscalls/fallocate/fallocate04.c | 49 ++++++++++++++++++----- 1 file changed, 39 insertions(+), 10 deletions(-)
testcases/kernel/syscalls/fallocate/fallocate04.c +39 -10
@@ -50,6 +50,8 @@ static const option_t options[] = { {NULL, NULL, NULL} }; +static off_t check_file_hole (int ,off_t ,off_t ); +static void help (void ) {printf (" -v Verbose\n" );
@@ -150,17 +152,12 @@ static void test02(void) }tst_resm (TINFO ,"check that file has a hole with lseek(,,SEEK_HOLE)" ); -off_t ret =lseek (fd,0 ,SEEK_HOLE ); -if (ret != (ssize_t )block_size) { -/* exclude error when kernel doesn't have SEEK_HOLE support */ -if (errno !=EINVAL ) { -tst_brkm (TFAIL |TERRNO , cleanup, -"fallocate() or lseek() failed" ); - } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); - } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); +off_t ret =check_file_hole (fd, block_size, block_size); +if (ret != (ssize_t )block_size) +tst_resm (TWARN |TERRNO ,"No file hole found" ); +else +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);size_t alloc_size1 =get_allocsize ();
@@ -275,3 +272,35 @@ int main(int argc, char *argv[])tst_exit (); } + +static off_t check_file_hole (int fd,off_t offset,off_t len) +{ +off_t ret; + + ret =lseek (fd,0 ,SEEK_HOLE ); +if (ret <0 ) { +/* exclude error when kernel doesn't have SEEK_HOLE support */ +if (errno !=EINVAL ) +tst_brkm (TFAIL |TERRNO , cleanup,"lseek() failed" ); + +int i; +char *buf; + +SAFE_LSEEK (cleanup, fd, offset,SEEK_SET ); + + buf =SAFE_MALLOC (cleanup, len); + +SAFE_READ (cleanup,1 , fd, buf, len); + +for (i =0 ; i < len; i++) { +if (buf[i] !='\0' ) +break ; + } + +free (buf); + +return i; + } + +return ret; +}
Signature · 15 lines
1.9.3 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] fallocate04: another check if SEEK_HOLE is not supported
Hi!
Quoted 31 lines · Zeng Linggang
SEEK_HOLEis only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supportedSEEK_HOLE.Signed-off-by Zeng Linggang <[email protected]>--- testcases/kernel/syscalls/fallocate/fallocate04.c | 49 ++++++++++++++++++----- 1 file changed, 39 insertions(+), 10 deletions(-)testcases/kernel/syscalls/fallocate/fallocate04.c +2
-5@@ -50,6 +50,8 @@ static const option_t options[] = { {NULL, NULL, NULL} }; +static off_t check_file_hole (int ,off_t ,off_t ); +static void help (void ) {printf (" -v Verbose\n" );@@ -150,17 +152,12 @@ static void test02(void) }tst_resm (TINFO ,"check that file has a hole with lseek(,,SEEK_HOLE)" ); -off_t ret =lseek (fd,0 ,SEEK_HOLE ); -if (ret != (ssize_t )block_size) { -/* exclude error when kernel doesn't have SEEK_HOLE support */ -if (errno !=EINVAL ) { - tst_brkm(TFAIL | TERRNO, cleanup,
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 160
Quoted 10 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +5
-5- "fallocate() or lseek() failed"); - } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); - } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); +off_t ret =check_file_hole (fd, block_size, block_size); +if (ret != (ssize_t )block_size) +tst_resm (TWARN |TERRNO ,"No file hole found" ); +else +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);
'check_file_data' function read the file and check for zeroes (a few lines after lseek), so 'check_file_hole' seems pointless here.
Best regards,
Alexey
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v2 1/1 fallocate04: another check if SEEK_HOLE is not supported
SEEK_HOLE is only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supported SEEK_HOLE.
--- testcases/kernel/syscalls/fallocate/fallocate04.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fallocate/fallocate04.c +10 -3
@@ -98,13 +98,13 @@ static void setup(void)get_blocksize (); } -static void check_file_data (const char exp_buf[],size_t size) +static void check_file_data_ (const char exp_buf[],size_t size,off_t offset) {char rbuf[size];tst_resm (TINFO ,"reading the file, compare with expected buffer" ); -SAFE_LSEEK (cleanup, fd,0 ,SEEK_SET ); +SAFE_LSEEK (cleanup, fd, offset,SEEK_SET );SAFE_READ (cleanup,1 , fd, rbuf, size);if (memcmp (exp_buf, rbuf, size)) {
@@ -116,6 +116,11 @@ static void check_file_data(const char exp_buf[], size_t size) } } +static inline void check_file_data (const char exp_buf[],size_t size) +{ +check_file_data_ (exp_buf, size,0 ); +} +static void test01 (void ) {tst_resm (TINFO ,"allocate '%zu' bytes" , buf_size);
@@ -158,7 +163,9 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +char zeros[block_size]; +memset (zeros,0 , block_size); +check_file_data_ (zeros, block_size, block_size); }tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);
Signature · 15 lines
1.9.3 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
----- Original Message -----
Quoted 50 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: "vasily isaenko" <[email protected]>, [email protected]
Sent: Tuesday, 19 May, 2015 10:50:22 AM
Subject: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not supported
SEEK_HOLEis only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supportedSEEK_HOLE.Signed-off-by Zhang Jin <[email protected]>--- testcases/kernel/syscalls/fallocate/fallocate04.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)testcases/kernel/syscalls/fallocate/fallocate04.c +2
-2@@ -98,13 +98,13 @@ static void setup(void)get_blocksize (); } -static void check_file_data (const char exp_buf[],size_t size) +static void check_file_data_ (const char exp_buf[],size_t size,off_t offset) {char rbuf[size];tst_resm (TINFO ,"reading the file, compare with expected buffer" ); -SAFE_LSEEK (cleanup, fd,0 ,SEEK_SET ); +SAFE_LSEEK (cleanup, fd, offset,SEEK_SET );SAFE_READ (cleanup,1 , fd, rbuf, size);testcases/kernel/syscalls/fallocate/fallocate04.c +5
-0if (memcmp (exp_buf, rbuf, size)) {@@ -116,6 +116,11 @@ static void check_file_data(const char exp_buf[], size_t size) } } +static inline void check_file_data (const char exp_buf[],size_t size) +{ +check_file_data_ (exp_buf, size,0 ); +} +static void test01 (void ) {testcases/kernel/syscalls/fallocate/fallocate04.c +0
-0tst_resm (TINFO ,"allocate '%zu' bytes" , buf_size);
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 168
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +3
-1@@ -158,7 +163,9 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +char zeros[block_size]; +memset (zeros,0 , block_size); +check_file_data_ (zeros, block_size, block_size);
Hi,
Isn't this redundant?
Couple lines below is this check, which also checks that range <block_size, block_size*2> is zeroed.
char exp_buf[buf_size];
fill_tst_buf(exp_buf);
memset(exp_buf + block_size, 0, block_size);
check_file_data(exp_buf, buf_size);Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
testcases/kernel/syscalls/fallocate/fallocate04.c +5 -2
@@ -158,9 +158,12 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 ) +tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); + }else { +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);size_t alloc_size1 =get_allocsize ();
Regards,
Jan
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
Hi!
Quoted 64 lines · Jan Stancek
----- Original Message -----
Quoted 50 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: "vasily isaenko" <[email protected]>, [email protected]
Sent: Tuesday, 19 May, 2015 10:50:22 AM
Subject: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not supported
SEEK_HOLEis only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supportedSEEK_HOLE.Signed-off-by Zhang Jin <[email protected]>--- testcases/kernel/syscalls/fallocate/fallocate04.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)testcases/kernel/syscalls/fallocate/fallocate04.c +2
-2@@ -98,13 +98,13 @@ static void setup(void)get_blocksize (); } -static void check_file_data (const char exp_buf[],size_t size) +static void check_file_data_ (const char exp_buf[],size_t size,off_t offset) {char rbuf[size];tst_resm (TINFO ,"reading the file, compare with expected buffer" ); -SAFE_LSEEK (cleanup, fd,0 ,SEEK_SET ); +SAFE_LSEEK (cleanup, fd, offset,SEEK_SET );SAFE_READ (cleanup,1 , fd, rbuf, size);testcases/kernel/syscalls/fallocate/fallocate04.c +5
-0if (memcmp (exp_buf, rbuf, size)) {@@ -116,6 +116,11 @@ static void check_file_data(const char exp_buf[], size_t size) } } +static inline void check_file_data (const char exp_buf[],size_t size) +{ +check_file_data_ (exp_buf, size,0 ); +} +static void test01 (void ) {testcases/kernel/syscalls/fallocate/fallocate04.c +0
-0tst_resm (TINFO ,"allocate '%zu' bytes" , buf_size);testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 168
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +3
-1@@ -158,7 +163,9 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +char zeros[block_size]; +memset (zeros,0 , block_size); +check_file_data_ (zeros, block_size, block_size);Hi,
Quoted 1 line
Isn't this redundant?
To be honest, I do not think it is redundant.
Quoted 3 lines
Couple lines below is this check, which also checks that range <
block_size, block_size*2> is zeroed.
Yep, this looks simple.
This maybe cost more runtime because of 'fill_tst_buf'. But I do not reject it.
Quoted 14 lines
char exp_buf[buf_size]; fill_tst_buf(exp_buf); memset(exp_buf + block_size, 0, block_size); check_file_data(exp_buf, buf_size);Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
testcases/kernel/syscalls/fallocate/fallocate04.c +0
-0
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 161
Quoted 5 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1@@ -158,9 +158,12 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 )
How about put them before lseek(SEEK_HOLE) ?
if (tst_kvercmp(3, 1, 0) < 0) {
fill_tst_buf();
memset();
check_file_data();
} else {
lseek(SEEK_HOLE);
...
}Thank you very much.
Best regards,
Zeng
Quoted 11 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +4
-1+tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); + }else { +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);size_t alloc_size1 =get_allocsize ();Regards,
Jan
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
----- Original Message -----
Quoted 77 lines
From: "Zeng Linggang" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: "Alexey Kodanev" <[email protected]>, "vasily isaenko" <[email protected]>, [email protected]
Sent: Wednesday, 20 May, 2015 3:47:22 AM
Subject: Re: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not supportedHi!
Quoted 67 lines · Jan Stancek
----- Original Message -----
Quoted 53 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: "vasily isaenko" <[email protected]>, [email protected]
Sent: Tuesday, 19 May, 2015 10:50:22 AM
Subject: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not
supported
SEEK_HOLEis only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supportedSEEK_HOLE.Signed-off-by Zhang Jin <[email protected]>--- testcases/kernel/syscalls/fallocate/fallocate04.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)testcases/kernel/syscalls/fallocate/fallocate04.c +2
-2@@ -98,13 +98,13 @@ static void setup(void)get_blocksize (); } -static void check_file_data (const char exp_buf[],size_t size) +static void check_file_data_ (const char exp_buf[],size_t size,off_t offset) {char rbuf[size];tst_resm (TINFO ,"reading the file, compare with expected buffer" ); -SAFE_LSEEK (cleanup, fd,0 ,SEEK_SET ); +SAFE_LSEEK (cleanup, fd, offset,SEEK_SET );SAFE_READ (cleanup,1 , fd, rbuf, size);testcases/kernel/syscalls/fallocate/fallocate04.c +0
-0if (memcmp (exp_buf, rbuf, size)) {@@ -116,6 +116,11 @@ static void check_file_data(const char exp_buf[],
size_t
size)testcases/kernel/syscalls/fallocate/fallocate04.c +5
-0} } +static inline void check_file_data (const char exp_buf[],size_t size) +{ +check_file_data_ (exp_buf, size,0 ); +} +static void test01 (void ) {tst_resm (TINFO ,"allocate '%zu' bytes" , buf_size);testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 168
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +3
-1@@ -158,7 +163,9 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +char zeros[block_size]; +memset (zeros,0 , block_size); +check_file_data_ (zeros, block_size, block_size);Hi,
Quoted 3 lines
Quoted 1 line
Isn't this redundant?
To be honest, I do not think it is redundant.
Can you explain why?
Quoted 8 lines
Quoted 4 lines
Couple lines below is this check, which also checks that range <
block_size, block_size*2> is zeroed.Yep, this looks simple.
This maybe cost more runtime because of 'fill_tst_buf'. But I do not reject it.
That code is already there, your patch is not removing it.
Quoted 10 lines
Quoted 10 lines
char exp_buf[buf_size]; fill_tst_buf(exp_buf); memset(exp_buf + block_size, 0, block_size); check_file_data(exp_buf, buf_size);Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
Quoted 14 lines
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 162
Quoted 12 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1@@ -158,9 +158,12 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE"); + if (tst_kvercmp (3 ,1 ,0 ) <0 )How about put them before
lseek(SEEK_HOLE)?
I think we should do the check on all kernels. lseek() can only check that the hole exists, but current check also verifies that hole has correct size and content.
Regards,
Jan
Quoted 11 lines
if (tst_kvercmp(3, 1, 0) < 0) {
fill_tst_buf();
memset();
check_file_data();
} else {
lseek(SEEK_HOLE);
...
}Quoted 20 lines
Thank you very much.
Best regards,
ZengQuoted 12 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +1
-0+ tst_resm(TINFO, "lseek() doesn't support SEEK_HOLE,"
testcases/kernel/syscalls/fallocate/fallocate04.c +3
-1+ "this is expected for < 3.1 kernels"); + }else { +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);size_t alloc_size1 =get_allocsize ();Regards,
Jan
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
Hi,
Quoted 123 lines · Jan Stancek
----- Original Message -----
Quoted 77 lines
From: "Zeng Linggang" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: "Alexey Kodanev" <[email protected]>, "vasily isaenko" <[email protected]>, [email protected]
Sent: Wednesday, 20 May, 2015 3:47:22 AM
Subject: Re: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not supportedHi!
Quoted 67 lines · Jan Stancek
----- Original Message -----
Quoted 53 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: "vasily isaenko" <[email protected]>, [email protected]
Sent: Tuesday, 19 May, 2015 10:50:22 AM
Subject: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not
supported
SEEK_HOLEis only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supportedSEEK_HOLE.Signed-off-by Zhang Jin <[email protected]>--- testcases/kernel/syscalls/fallocate/fallocate04.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)testcases/kernel/syscalls/fallocate/fallocate04.c +2
-2@@ -98,13 +98,13 @@ static void setup(void)get_blocksize (); } -static void check_file_data (const char exp_buf[],size_t size) +static void check_file_data_ (const char exp_buf[],size_t size,off_t offset) {char rbuf[size];tst_resm (TINFO ,"reading the file, compare with expected buffer" ); -SAFE_LSEEK (cleanup, fd,0 ,SEEK_SET ); +SAFE_LSEEK (cleanup, fd, offset,SEEK_SET );SAFE_READ (cleanup,1 , fd, rbuf, size);testcases/kernel/syscalls/fallocate/fallocate04.c +0
-0if (memcmp (exp_buf, rbuf, size)) {@@ -116,6 +116,11 @@ static void check_file_data(const char exp_buf[],
size_t
size)testcases/kernel/syscalls/fallocate/fallocate04.c +5
-0} } +static inline void check_file_data (const char exp_buf[],size_t size) +{ +check_file_data_ (exp_buf, size,0 ); +} +static void test01 (void ) {tst_resm (TINFO ,"allocate '%zu' bytes" , buf_size);testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 168
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +3
-1@@ -158,7 +163,9 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +char zeros[block_size]; +memset (zeros,0 , block_size); +check_file_data_ (zeros, block_size, block_size);Hi,
Quoted 3 lines
Quoted 1 line
Isn't this redundant?
To be honest, I do not think it is redundant.
Can you explain why?
Quoted 8 lines
Quoted 4 lines
Couple lines below is this check, which also checks that range <
block_size, block_size*2> is zeroed.Yep, this looks simple.
This maybe cost more runtime because of 'fill_tst_buf'. But I do not reject it.That code is already there, your patch is not removing it.
Quoted 10 lines
Quoted 10 lines
char exp_buf[buf_size]; fill_tst_buf(exp_buf); memset(exp_buf + block_size, 0, block_size); check_file_data(exp_buf, buf_size);Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
Quoted 14 lines
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 162
Quoted 12 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1@@ -158,9 +158,12 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE"); + if (tst_kvercmp (3 ,1 ,0 ) <0 )How about put them before
lseek(SEEK_HOLE)?
Quoted 4 lines
I think we should do the check on all kernels.
lseek()can only check that the hole exists, but current check also verifies that hole has correct size and content.
Right. It is the strict way we need to do. But it would make the test complex. Now, "turn that warning into TINFO" looks simple but effective. If nobody reject, I will send new patch like:
- tst_resm(TWARN | TERRNO, "lseek() doesn't support SEEK_HOLE");
+ if (tst_kvercmp(3, 1, 0) < 0)
+ tst_resm(TINFO, "lseek() doesn't support SEEK_HOLE, "
+ "this is expected for < 3.1 kernels");
+ } else {
+ tst_resm(TINFO, "found a hole at '%ld' offset", ret);
}
- tst_resm(TINFO, "found a hole at '%ld' offset", ret);
Thank you.
Best regards,
Zeng
Quoted 2 lines
Regards,
Jan
[...]
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
----- Original Message -----
Quoted 141 lines
From: "Zeng Linggang" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: "Alexey Kodanev" <[email protected]>, "vasily isaenko" <[email protected]>, [email protected]
Sent: Wednesday, 20 May, 2015 11:58:01 AM
Subject: Re: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not supportedHi,
Quoted 131 lines · Jan Stancek
----- Original Message -----
Quoted 84 lines
From: "Zeng Linggang" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: "Alexey Kodanev" <[email protected]>, "vasily isaenko" <[email protected]>,
[email protected]
Sent: Wednesday, 20 May, 2015 3:47:22 AM
Subject: Re: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not supportedHi!
Quoted 72 lines · Jan Stancek
----- Original Message -----
Quoted 58 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: "vasily isaenko" <[email protected]>, [email protected]
Sent: Tuesday, 19 May, 2015 10:50:22 AM
Subject: [LTP] [PATCH v2] fallocate04: another check ifSEEK_HOLEis not
supported
SEEK_HOLEis only supported since version 3.1. Check the specified range blocks are zeroed while the kernel does not supportedSEEK_HOLE.Signed-off-by Zhang Jin <[email protected]>--- testcases/kernel/syscalls/fallocate/fallocate04.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1@@ -98,13 +98,13 @@ static void setup(void)get_blocksize (); } -static void check_file_data (const char exp_buf[],size_t size) +static void check_file_data_(const char exp_buf[], size_t size,
off_t
offset)
{testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1char rbuf[size];tst_resm (TINFO ,"reading the file, compare with expected buffer" ); -SAFE_LSEEK (cleanup, fd,0 ,SEEK_SET ); +SAFE_LSEEK (cleanup, fd, offset,SEEK_SET );SAFE_READ (cleanup,1 , fd, rbuf, size);if (memcmp (exp_buf, rbuf, size)) {@@ -116,6 +116,11 @@ static void check_file_data(const char exp_buf[],
size_t
size)testcases/kernel/syscalls/fallocate/fallocate04.c +1
-0} } +static inline void check_file_data(const char exp_buf[], size_tsize)
testcases/kernel/syscalls/fallocate/fallocate04.c +4
-0+{ +check_file_data_ (exp_buf, size,0 ); +} +static void test01 (void ) {tst_resm (TINFO ,"allocate '%zu' bytes" , buf_size);testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 168
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +3
-1@@ -158,7 +163,9 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +char zeros[block_size]; +memset (zeros,0 , block_size); +check_file_data_ (zeros, block_size, block_size);Hi,
Quoted 3 lines
Quoted 1 line
Isn't this redundant?
To be honest, I do not think it is redundant.
Can you explain why?
Quoted 8 lines
Quoted 4 lines
Couple lines below is this check, which also checks that range <
block_size, block_size*2> is zeroed.Yep, this looks simple.
This maybe cost more runtime because of 'fill_tst_buf'. But I do not reject it.That code is already there, your patch is not removing it.
Quoted 25 lines
Quoted 17 lines
char exp_buf[buf_size]; fill_tst_buf(exp_buf); memset(exp_buf + block_size, 0, block_size); check_file_data(exp_buf, buf_size);Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
testcases/kernel/syscalls/fallocate/fallocate04.c +0
-0testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 162
Quoted 6 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1@@ -158,9 +158,12 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE"); + if (tst_kvercmp (3 ,1 ,0 ) <0 )How about put them before
lseek(SEEK_HOLE)?
Quoted 8 lines
Quoted 5 lines
I think we should do the check on all kernels.
lseek()can only check that the
hole exists, but current check also verifies that hole has correct size and content.Right. It is the strict way we need to do. But it would make the test complex.
I think we already check it strictly, see line 172-177. This covers blocks 1,2,3. The patch you proposed _adds_ one more check only for zero-ed block 2. My objection was that this seems redundant, because we already have a check (line 172-177), which covers all 3 blocks. Am I missing something?
Quoted 2 lines
Now, "turn that warning into TINFO" looks simple but effective. If nobody reject, I will send new patch like:
Looks OK to me, though maybe it should TBROK on kernels > 3.1 even when errno is EINVAL.
Regards,
Jan
Quoted 13 lines
- tst_resm(TWARN | TERRNO, "
lseek()doesn't supportSEEK_HOLE");testcases/kernel/syscalls/fallocate/fallocate04.c +5
-1+if (tst_kvercmp (3 ,1 ,0 ) <0 ) +tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); + }else { +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);Thank you.
Quoted 9 lines
Best regards,
ZengQuoted 2 lines
Regards,
Jan[...]
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
On Wed, 2015-05-20 at 07:32 -0400, Jan Stancek wrote:
[...]
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
How about put them before
lseek(SEEK_HOLE)?I think we should do the check on all kernels.
lseek()can only check that the
hole exists, but current check also verifies that hole has correct size and content.
Quoted 8 lines
Quoted 2 lines
Right. It is the strict way we need to do. But it would make the test complex.
I think we already check it strictly, see line 172-177. This covers blocks 1,2,3. The patch you proposed _adds_ one more check only for zero-ed block 2. My objection was that this seems redundant, because we already have a check (line 172-177), which covers all 3 blocks. Am I missing something?
Oh, I see. I misunderstand your reply previous. Right, the patch is redundant.
Thank you.
Quoted 5 lines
Quoted 2 lines
Now, "turn that warning into TINFO" looks simple but effective. If nobody reject, I will send new patch like:
Looks OK to me, though maybe it should TBROK on kernels > 3.1 even when errno is EINVAL.
OK. I will fix it at the same time.
Thanks.
Best regards,
Zeng
Quoted 26 lines
Regards,
JanQuoted 22 lines
- tst_resm(TWARN | TERRNO, "
lseek()doesn't supportSEEK_HOLE");testcases/kernel/syscalls/fallocate/fallocate04.c +5
-1+if (tst_kvercmp (3 ,1 ,0 ) <0 ) +tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); + }else { +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);Thank you.
Best regards,
ZengQuoted 2 lines
Regards,
Jan[...]
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
In reply to Zeng LinggangHi,
Quoted 3 lines · Zeng Linggang
Hi!
On Tue, 2015-05-19 at 07:18 -0400, Jan Stancek wrote:
[ ... ]
Quoted 14 lines
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 161
Quoted 12 lines
Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1@@ -158,9 +158,12 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 )How about put them before
lseek(SEEK_HOLE)?
Quoted 8 lines
if (tst_kvercmp(3, 1, 0) < 0) {
fill_tst_buf();
memset();
check_file_data();
} else {
lseek(SEEK_HOLE);
...
}Please don't complicate the test-case with this, I agree with Jan, it is enough to add the kernel version check. It can be as follows:
testcases/kernel/syscalls/fallocate/fallocate04.c +0 -1
@@ -158,7 +158,8 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } - tst_resm(TWARN | TERRNO, "lseek() doesn't support
SEEK_HOLE");
+ tst_resm((tst_kvercmp(3, 1, 0) < 0) ? TINFO : (TWARN |
TERRNO),
+ "lseek() doesn't support SEEK_HOLE");
}
tst_resm(TINFO, "found a hole at '%ld' offset", ret);Best regards,
Alexey
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported
Hi, Alexey and Jan
Quoted 29 lines · Alexey Kodanev
Hi,
Quoted 3 lines · Zeng Linggang
Hi!
On Tue, 2015-05-19 at 07:18 -0400, Jan Stancek wrote:
[ ... ]
Quoted 14 lines
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void) · line 161
Quoted 12 lines
Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
testcases/kernel/syscalls/fallocate/fallocate04.c +1
-1@@ -158,9 +158,12 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 )How about put them before
lseek(SEEK_HOLE)?Quoted 8 lines
if (tst_kvercmp(3, 1, 0) < 0) { fill_tst_buf(); memset(); check_file_data(); } else { lseek(SEEK_HOLE); ... }
Quoted 2 lines
Please don't complicate the test-case with this, I agree with Jan, it is enough to add the kernel version check. It can be as follows:
OK. I will do as that.
Thank both of you.
Best regards,
Zeng
Quoted 16 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +2
-1@@ -158,7 +158,8 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE"); + tst_resm((tst_kvercmp (3 ,1 ,0 ) <0 ) ?TINFO : (TWARN |TERRNO ), +"lseek() doesn't support SEEK_HOLE" ); }tst_resm(TINFO, "found a hole at '%ld' offset", ret);
Quoted 3 lines
Best regards,
Alexey
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 fallocate04: Use tst_kvercmp after lseek(SEEK_HOLE) return EINVAL
In reply to Alexey KodanevSEEK_HOLE is only supported since version 3.1. Just print some information to remind users if kernel is before 3.1, if not print 'TBROK' and quit, instead of 'TWARN'.
--- testcases/kernel/syscalls/fallocate/fallocate04.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/fallocate/fallocate04.c +8 -2
@@ -158,9 +158,15 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 ) +tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); +else +tst_brkm (TBROK |TERRNO , cleanup, +"lseek() doesn't support SEEK_HOLE" ); + }else { +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);size_t alloc_size1 =get_allocsize ();
Signature · 15 lines
1.9.3 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] fallocate04: Use tst_kvercmp after lseek(SEEK_HOLE) return EINVAL
----- Original Message -----
Quoted 9 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: [email protected], "vasily isaenko" <[email protected]>
Sent: Thursday, 21 May, 2015 7:39:37 AM
Subject: [LTP] [PATCH] fallocate04: Usetst_kvercmpafterlseek(SEEK_HOLE)return EINVAL
SEEK_HOLEis only supported since version 3.1. Just print some information to remind users if kernel is before 3.1, if not print 'TBROK' and quit, instead of 'TWARN'.
Looks OK to me. Alexey, any objections from your side?
Regards,
Jan
Quoted 37 lines
Signed-off-by Zeng Linggang <[email protected]>Signed-off-by Jan Stancek <[email protected]>Signed-off-by Alexey Kodanev <[email protected]>--- testcases/kernel/syscalls/fallocate/fallocate04.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)testcases/kernel/syscalls/fallocate/fallocate04.c +8
-3@@ -158,9 +158,15 @@ static void test02(void)tst_brkm (TFAIL |TERRNO , cleanup,"fallocate() or lseek() failed" ); } -tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 ) +tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); +else +tst_brkm (TBROK |TERRNO , cleanup, +"lseek() doesn't support SEEK_HOLE" ); + }else { +tst_resm (TINFO ,"found a hole at '%ld' offset" , ret); } -tst_resm (TINFO ,"found a hole at '%ld' offset" , ret);size_t alloc_size1 =get_allocsize (); --1.9.3
Quoted 11 lines
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] fallocate04: Use tst_kvercmp after lseek(SEEK_HOLE) return EINVAL
Hi,
Quoted 11 lines · Jan Stancek
----- Original Message -----
Quoted 9 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: [email protected], "vasily isaenko" <[email protected]>
Sent: Thursday, 21 May, 2015 7:39:37 AM
Subject: [LTP] [PATCH] fallocate04: Usetst_kvercmpafterlseek(SEEK_HOLE)return EINVAL
SEEK_HOLEis only supported since version 3.1. Just print some information to remind users if kernel is before 3.1, if not print 'TBROK' and quit, instead of 'TWARN'.Looks OK to me. Alexey, any objections from your side?
Sorry for the delay, looks good to me. There is stylistic comment below, but it is minor:
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void)
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +6
-1-tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 ) +tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); +else + tst_brkm(TBROK | TERRNO, cleanup, +
It would be better to add curly braces around multiline 'if else' block.
Thanks,
Alexey
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] fallocate04: Use tst_kvercmp after lseek(SEEK_HOLE) return EINVAL
----- Original Message -----
Quoted 25 lines
From: "Alexey Kodanev" <[email protected]>
To: "Jan Stancek" <[email protected]>, "Zeng Linggang" <[email protected]>
Cc: [email protected], "vasily isaenko" <[email protected]>
Sent: Thursday, 4 June, 2015 1:35:50 PM
Subject: Re: [LTP] [PATCH] fallocate04: Usetst_kvercmpafterlseek(SEEK_HOLE)return EINVALHi,
Quoted 9 lines · Jan Stancek
----- Original Message -----
Quoted 8 lines
From: "Zeng Linggang" <[email protected]>
To: "Alexey Kodanev" <[email protected]>
Cc: [email protected], "vasily isaenko" <[email protected]>
Sent: Thursday, 21 May, 2015 7:39:37 AM
Subject: [LTP] [PATCH] fallocate04: Usetst_kvercmpafterlseek(SEEK_HOLE)return EINVALQuoted 4 lines
Quoted 3 lines
SEEK_HOLEis only supported since version 3.1. Just print some information to remind users if kernel is before 3.1, if not print 'TBROK' and quit, instead of 'TWARN'.Looks OK to me. Alexey, any objections from your side?
Sorry for the delay, looks good to me. There is stylistic comment below, but it is minor:
Quoted 9 lines
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c static void test02(void)
Quoted 7 lines
testcases/kernel/syscalls/fallocate/fallocate04.c +6
-1-tst_resm (TWARN |TERRNO ,"lseek() doesn't support SEEK_HOLE" ); +if (tst_kvercmp (3 ,1 ,0 ) <0 ) +tst_resm (TINFO ,"lseek() doesn't support SEEK_HOLE, " +"this is expected for < 3.1 kernels" ); +else + tst_brkm(TBROK | TERRNO, cleanup, +It would be better to add curly braces around multiline 'if else' block.
Pushed with curly braces.
Regards,
Jan
Quoted 5 lines
Thanks,
Alexey
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list