ioprio minor cleanup
cover ioprio minor cleanup
Further minor ioprio cleanup. NOTE, docparse markers /*\ [Description] in the second commit allow test to be included in our automatically generated documentation [1].
Kind regards,
Petr
[1] https://github.com/linux-test-project/ltp/releases/download/20230516/metadata.20230516.html
Petr Vorel (3):
ioprio: Move fallback constants and structs to LAPI header
ioprio: Add docparse markers
utils: Remove unused ioprio.h
include/lapi/ioprio.h | 47 +++++++++++++++++++ testcases/kernel/syscalls/ioprio/ioprio.h | 42 ++--------------- .../kernel/syscalls/ioprio/ioprio_get01.c | 9 ++-- .../kernel/syscalls/ioprio/ioprio_set01.c | 9 ++-- .../kernel/syscalls/ioprio/ioprio_set02.c | 9 ++-- .../kernel/syscalls/ioprio/ioprio_set03.c | 9 ++-- testcases/kernel/syscalls/utils/ioprio.h | 46 ------------------ 7 files changed, 71 insertions(+), 100 deletions(-) create mode 100644 include/lapi/ioprio.h delete mode 100644 testcases/kernel/syscalls/utils/ioprio.h
Signature · 5 lines
2.40.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/3 ioprio: Move fallback constants and structs to LAPI header
Originally lapi headers were only for common headers, for fallback constants and structs usable only in test for particular subsystem, we mix them together with other helper functions in header placed in the test directory. But later we started to move to lapi also these fallbacks (e.g. fanotify.h in a05dbc4fa).
+ Remove unused headers in the tests.
--- include/lapi/ioprio.h | 47 +++++++++++++++++++ testcases/kernel/syscalls/ioprio/ioprio.h | 42 ++--------------- .../kernel/syscalls/ioprio/ioprio_get01.c | 3 -- .../kernel/syscalls/ioprio/ioprio_set01.c | 3 -- .../kernel/syscalls/ioprio/ioprio_set02.c | 3 -- .../kernel/syscalls/ioprio/ioprio_set03.c | 3 -- 6 files changed, 51 insertions(+), 50 deletions(-) create mode 100644 include/lapi/ioprio.h
include/lapi/ioprio.h new file +47 -0
@@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (c) 2019 Linus Walleij <[email protected]> +*/ + +#ifndef LAPI_IOPRIO_H__ +#define LAPI_IOPRIO_H__ + +#include "config.h" + +#ifdef HAVE_LINUX_IOPRIO_H +# include <linux/ioprio.h> +#else + +enum { +IOPRIO_CLASS_NONE =0 , +IOPRIO_CLASS_RT , +IOPRIO_CLASS_BE , +IOPRIO_CLASS_IDLE , +}; + +enum { +IOPRIO_WHO_PROCESS =1 , +IOPRIO_WHO_PGRP , +IOPRIO_WHO_USER , +}; + +# define IOPRIO_CLASS_SHIFT (13) +# define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1) + +# define IOPRIO_PRIO_CLASS (data) ((data) >> IOPRIO_CLASS_SHIFT) +# define IOPRIO_PRIO_VALUE (class, data) (((class) << IOPRIO_CLASS_SHIFT) | data) + +#endif + +/* The RT and BE I/O priority classes have 8 priority levels 0..7 */ +#ifdef IOPRIO_NR_LEVELS +# define IOPRIO_PRIO_NUM IOPRIO_NR_LEVELS +#else +# define IOPRIO_PRIO_NUM 8 +#endif + +#ifndef IOPRIO_PRIO_LEVEL +# define IOPRIO_PRIO_LEVEL (data) ((data) & IOPRIO_PRIO_MASK) +#endif + +#endif /* LAPI_IOPRIO_H__ */
testcases/kernel/syscalls/ioprio/ioprio.h +4 -38
56 lines not on this page · raw message
testcases/kernel/syscalls/ioprio/ioprio_get01.c +0 -3
@@ -6,11 +6,8 @@* Basic ioprio_get() test. Gets the current process I/O priority and * checks that the values are sane. */ -#include <sys/types.h> -#include <sys/syscall.h> #include "tst_test.h" -#include "lapi/syscalls.h" #include "ioprio.h" static void run (void )
testcases/kernel/syscalls/ioprio/ioprio_set01.c +0 -3
@@ -7,11 +7,8 @@* bumps it up one notch, then down two notches and checks that the * new priority is reported back correctly. */ -#include <sys/types.h> -#include <sys/syscall.h> #include "tst_test.h" -#include "lapi/syscalls.h" #include "ioprio.h" static int orig_class;
testcases/kernel/syscalls/ioprio/ioprio_set02.c +0 -3
@@ -7,11 +7,8 @@* Tests to set all 8 priority levels for best effort priority, then * switches to test all 8 priority levels for idle priority. */ -#include <sys/types.h> -#include <sys/syscall.h> #include "tst_test.h" -#include "lapi/syscalls.h" #include "ioprio.h" static void run (void )
testcases/kernel/syscalls/ioprio/ioprio_set03.c +0 -3
@@ -6,11 +6,8 @@* Negative ioprio_set() test. Test some non-working priorities to make * sure they don't work. */ -#include <sys/types.h> -#include <sys/syscall.h> #include "tst_test.h" -#include "lapi/syscalls.h" #include "ioprio.h" static void run (void )
Signature · 5 lines
2.40.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/3] ioprio: Move fallback constants and structs to LAPI header
Quoted 10 lines · Petr Vorel
Originally lapi headers were only for common headers, for fallback constants and structs usable only in test for particular subsystem, we mix them together with other helper functions in header placed in the test directory. But later we started to move to lapi also these fallbacks (e.g.
fanotify.hina05dbc4fa).+ Remove unused headers in the tests.
Signed-off-by Petr Vorel <[email protected]>---
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/3 ioprio: Add docparse markers
In reply to Petr Vorel--- testcases/kernel/syscalls/ioprio/ioprio_get01.c | 6 +++++- testcases/kernel/syscalls/ioprio/ioprio_set01.c | 6 +++++- testcases/kernel/syscalls/ioprio/ioprio_set02.c | 6 +++++- testcases/kernel/syscalls/ioprio/ioprio_set03.c | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/ioprio/ioprio_get01.c +5 -1
@@ -1,8 +1,12 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 Linus Walleij <[email protected]> +* Copyright (c) 2023 Linux Test Project +*/ + +/*\ +* [Description] * -* Description: * Basic ioprio_get() test. Gets the current process I/O priority and * checks that the values are sane. */
testcases/kernel/syscalls/ioprio/ioprio_set01.c +5 -1
@@ -1,8 +1,12 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 Linus Walleij <[email protected]> +* Copyright (c) 2019-2023 Linux Test Project +*/ + +/*\ +* [Description] * -* Description: * Basic ioprio_set() test. Gets the current process I/O priority and * bumps it up one notch, then down two notches and checks that the * new priority is reported back correctly.
testcases/kernel/syscalls/ioprio/ioprio_set02.c +5 -1
@@ -1,8 +1,12 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 Linus Walleij <[email protected]> +* Copyright (c) 2023 Linux Test Project +*/ + +/*\ +* [Description] * -* Description: * Extended ioprio_set() test. * Tests to set all 8 priority levels for best effort priority, then * switches to test all 8 priority levels for idle priority.
testcases/kernel/syscalls/ioprio/ioprio_set03.c +5 -1
@@ -1,8 +1,12 @@// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 Linus Walleij <[email protected]> +* Copyright (c) 2023 Linux Test Project +*/ + +/*\ +* [Description] * -* Description: * Negative ioprio_set() test. Test some non-working priorities to make * sure they don't work. */
Signature · 5 lines
2.40.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/3] ioprio: Add docparse markers
Quoted 2 lines · Petr Vorel
Signed-off-by Petr Vorel <[email protected]>---
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 3/3 utils: Remove unused ioprio.h
In reply to Petr VorelIt was added in 0a1e45f09 (in 2009), but even then it was not needed.
--- testcases/kernel/syscalls/utils/ioprio.h | 46 ------------------------ 1 file changed, 46 deletions(-) delete mode 100644 testcases/kernel/syscalls/utils/ioprio.h
testcases/kernel/syscalls/utils/ioprio.h deleted +0 -46
@@ -1,46 +0,0 @@ -#ifndef __IOPRIO_H__ -#define __IOPRIO_H__ - -//---------------------------------------------------------------------------- -// Copy of the 2.6.18 kernel header (linux/ioprio.h) -// - -/* -* Gives us 8 prio classes with 13-bits of data for each class -*/ -#define IOPRIO_BITS (16) -#define IOPRIO_CLASS_SHIFT (13) -#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1) - -#define IOPRIO_PRIO_CLASS (mask) ((mask) >> IOPRIO_CLASS_SHIFT) -#define IOPRIO_PRIO_DATA (mask) ((mask) & IOPRIO_PRIO_MASK) -#define IOPRIO_PRIO_VALUE (class, data) (((class) << IOPRIO_CLASS_SHIFT) | data) - -#define ioprio_valid (mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE) - -/* -* These are the io priority groups as implemented by CFQ. RT is the realtime -* class, it always gets premium service. BE is the best-effort scheduling -* class, the default for any process. IDLE is the idle scheduling class, it -* is only served when no one else is using the disk. -*/ -enum { -IOPRIO_CLASS_NONE , -IOPRIO_CLASS_RT , -IOPRIO_CLASS_BE , -IOPRIO_CLASS_IDLE , -}; - -/* -* 8 best effort priority levels are supported -*/ -#define IOPRIO_BE_NR (8) - -enum { -IOPRIO_WHO_PROCESS =1 , -IOPRIO_WHO_PGRP , -IOPRIO_WHO_USER , -}; -//----------------------------------------------------------------------------- - -#endif /* __IOPRIO_H__ */
Signature · 5 lines
2.40.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 3/3] utils: Remove unused ioprio.h
Quoted 4 lines · Petr Vorel
It was added in
0a1e45f09(in 2009), but even then it was not needed.Signed-off-by Petr Vorel <[email protected]>---
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 8 lines · Petr Vorel
Further minor ioprio cleanup. NOTE, docparse markers /*\ [Description] in the second commit allow test to be included in our automatically generated documentation [1].
Kind regards,
Petr[1] https://github.com/linux-test-project/ltp/releases/download/20230516/metadata.20230516.html
Looks good. Thanks Petr !
For the series:
Quoted 17 lines
Petr Vorel (3):
ioprio: Move fallback constants and structs to LAPI header
ioprio: Add docparse markers
utils: Remove unusedioprio.hinclude/lapi/ioprio.h | 47 +++++++++++++++++++ testcases/kernel/syscalls/ioprio/ioprio.h | 42 ++--------------- .../kernel/syscalls/ioprio/ioprio_get01.c | 9 ++-- .../kernel/syscalls/ioprio/ioprio_set01.c | 9 ++-- .../kernel/syscalls/ioprio/ioprio_set02.c | 9 ++-- .../kernel/syscalls/ioprio/ioprio_set03.c | 9 ++-- testcases/kernel/syscalls/utils/ioprio.h | 46 ------------------ 7 files changed, 71 insertions(+), 100 deletions(-) create mode 100644 include/lapi/ioprio.h delete mode 100644 testcases/kernel/syscalls/utils/ioprio.h
Signature · 6 lines
Damien Le Moal Western Digital Research -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi all,
thanks for your review, patchset merged.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp