diff mbox series

[v1] Reduce default number of threads in dio_sparse.c

Message ID 20220118105044.547-1-andrea.cervesato@suse.de
State Accepted
Headers show
Series [v1] Reduce default number of threads in dio_sparse.c | expand

Commit Message

Andrea Cervesato Jan. 18, 2022, 10:50 a.m. UTC
Initialized options out of setup and reduced default number of
threads from 1000 to 16

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.de>
---
 testcases/kernel/io/ltp-aiodio/dio_sparse.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

Comments

Martin Doucha Jan. 18, 2022, 12:11 p.m. UTC | #1
Hi,
it'd have been better to move the defaults out of setup() in a separate
commit let's push it as is this time.

Reviewed-by: Martin Doucha <mdoucha@suse.cz>

On 18. 01. 22 11:50, Andrea Cervesato wrote:
> Initialized options out of setup and reduced default number of
> threads from 1000 to 16
> 
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.de>
> ---
>  testcases/kernel/io/ltp-aiodio/dio_sparse.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> index 929adbfba..8635df82f 100644
> --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> @@ -33,11 +33,11 @@ static char *str_writesize;
>  static char *str_filesize;
>  static char *str_offset;
>  
> -static int numchildren;
> -static long long writesize;
> -static long long filesize;
> -static long long offset;
> -static long long alignment;
> +static int numchildren = 16;
> +static long long writesize = 1024;
> +static long long filesize = 100 * 1024 * 1024;
> +static long long offset = 0;
> +static long long alignment = 512;
>  
>  static void dio_sparse(int fd, int align, long long fs, int ws, long long off)
>  {
> @@ -60,12 +60,6 @@ static void setup(void)
>  {
>  	struct stat sb;
>  
> -	numchildren = 1000;
> -	writesize = 1024;
> -	filesize = 100 * 1024 * 1024;
> -	offset = 0;
> -	alignment = 512;
> -
>  	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
>  		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
>  
> @@ -129,7 +123,7 @@ static struct tst_test test = {
>  	.needs_tmpdir = 1,
>  	.forks_child = 1,
>  	.options = (struct tst_option[]) {
> -		{"n:", &str_numchildren, "Number of threads (default 1000)"},
> +		{"n:", &str_numchildren, "Number of threads (default 16)"},
>  		{"w:", &str_writesize, "Size of writing blocks (default 1K)"},
>  		{"s:", &str_filesize, "Size of file (default 100M)"},
>  		{"o:", &str_offset, "File offset (default 0)"},
Cyril Hrubis Jan. 18, 2022, 1:02 p.m. UTC | #2
Hi!
> Initialized options out of setup and reduced default number of
> threads from 1000 to 16

I've added a bit more verbose descriptioin here about how the default
has changed and pushed, thanks.

> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.de>
> ---
>  testcases/kernel/io/ltp-aiodio/dio_sparse.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> index 929adbfba..8635df82f 100644
> --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> @@ -33,11 +33,11 @@ static char *str_writesize;
>  static char *str_filesize;
>  static char *str_offset;
>  
> -static int numchildren;
> -static long long writesize;
> -static long long filesize;
> -static long long offset;
> -static long long alignment;
> +static int numchildren = 16;
> +static long long writesize = 1024;
> +static long long filesize = 100 * 1024 * 1024;
> +static long long offset = 0;
> +static long long alignment = 512;

I've also removed this assignment since alignment is initialized
unconditionally.

>  static void dio_sparse(int fd, int align, long long fs, int ws, long long off)
>  {
> @@ -60,12 +60,6 @@ static void setup(void)
>  {
>  	struct stat sb;
>  
> -	numchildren = 1000;
> -	writesize = 1024;
> -	filesize = 100 * 1024 * 1024;
> -	offset = 0;
> -	alignment = 512;
> -
>  	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
>  		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
>  
> @@ -129,7 +123,7 @@ static struct tst_test test = {
>  	.needs_tmpdir = 1,
>  	.forks_child = 1,
>  	.options = (struct tst_option[]) {
> -		{"n:", &str_numchildren, "Number of threads (default 1000)"},
> +		{"n:", &str_numchildren, "Number of threads (default 16)"},
>  		{"w:", &str_writesize, "Size of writing blocks (default 1K)"},
>  		{"s:", &str_filesize, "Size of file (default 100M)"},
>  		{"o:", &str_offset, "File offset (default 0)"},
> -- 
> 2.34.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
diff mbox series

Patch

diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
index 929adbfba..8635df82f 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
@@ -33,11 +33,11 @@  static char *str_writesize;
 static char *str_filesize;
 static char *str_offset;
 
-static int numchildren;
-static long long writesize;
-static long long filesize;
-static long long offset;
-static long long alignment;
+static int numchildren = 16;
+static long long writesize = 1024;
+static long long filesize = 100 * 1024 * 1024;
+static long long offset = 0;
+static long long alignment = 512;
 
 static void dio_sparse(int fd, int align, long long fs, int ws, long long off)
 {
@@ -60,12 +60,6 @@  static void setup(void)
 {
 	struct stat sb;
 
-	numchildren = 1000;
-	writesize = 1024;
-	filesize = 100 * 1024 * 1024;
-	offset = 0;
-	alignment = 512;
-
 	if (tst_parse_int(str_numchildren, &numchildren, 1, INT_MAX))
 		tst_brk(TBROK, "Invalid number of children '%s'", str_numchildren);
 
@@ -129,7 +123,7 @@  static struct tst_test test = {
 	.needs_tmpdir = 1,
 	.forks_child = 1,
 	.options = (struct tst_option[]) {
-		{"n:", &str_numchildren, "Number of threads (default 1000)"},
+		{"n:", &str_numchildren, "Number of threads (default 16)"},
 		{"w:", &str_writesize, "Size of writing blocks (default 1K)"},
 		{"s:", &str_filesize, "Size of file (default 100M)"},
 		{"o:", &str_offset, "File offset (default 0)"},