block/blk-iocost (gcc13): move large values to a new enum
Subsystems (3)
PATCH v2 1/1 block/blk-iocost (gcc13): move large values to a new enum
Since gcc13, each member of an enum has the same type as the enum [1]. And that is inherited from its members. Provided:
VTIME_PER_SEC_SHIFT = 37,
VTIME_PER_SEC = 1LLU << VTIME_PER_SEC_SHIFT,
the named type is unsigned long.
This generates warnings with gcc-13:
block/blk-iocost.c: In function 'ioc_weight_prfill':
block/blk-iocost.c:3037:37: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int'
block/blk-iocost.c: In function 'ioc_weight_show':
block/blk-iocost.c:3047:34: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int'
So move the large VTIME values away to a separate enum, so that they don't affect other members. Move also VRATE ones as they depend on VTIME.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113
---
Notes:
[v2] move to a new enum
block/blk-iocost.c | 48 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-)
block/blk-iocost.c +25 -23
@@ -233,29 +233,6 @@ enum {/* 1/64k is granular enough and can easily be handled w/ u32 */ WEIGHT_ONE =1 <<16 , -/* -* As vtime is used to calculate the cost of each IO, it needs to -* be fairly high precision. For example, it should be able to -* represent the cost of a single page worth of discard with -* suffificient accuracy. At the same time, it should be able to -* represent reasonably long enough durations to be useful and -* convenient during operation. -* -* 1s worth of vtime is 2^37. This gives us both sub-nanosecond -* granularity and days of wrap-around time even at extreme vrates. -*/ -VTIME_PER_SEC_SHIFT =37 , -VTIME_PER_SEC =1LLU <<VTIME_PER_SEC_SHIFT , -VTIME_PER_USEC =VTIME_PER_SEC /USEC_PER_SEC , -VTIME_PER_NSEC =VTIME_PER_SEC /NSEC_PER_SEC , - -/* bound vrate adjustments within two orders of magnitude */ -VRATE_MIN_PPM =10000 ,/* 1% */ -VRATE_MAX_PPM =100000000 ,/* 10000% */ - -VRATE_MIN =VTIME_PER_USEC *VRATE_MIN_PPM /MILLION , -VRATE_CLAMP_ADJ_PCT =4 , -/* if IOs end up waiting for requests, issue less */ RQ_WAIT_BUSY_PCT = 5,
@@ -310,6 +287,31 @@ enum { LCOEF_RANDIO_PAGES = 4096, }; +enum { +/* +* As vtime is used to calculate the cost of each IO, it needs to +* be fairly high precision. For example, it should be able to +* represent the cost of a single page worth of discard with +* suffificient accuracy. At the same time, it should be able to +* represent reasonably long enough durations to be useful and +* convenient during operation. +* +* 1s worth of vtime is 2^37. This gives us both sub-nanosecond +* granularity and days of wrap-around time even at extreme vrates. +*/ +VTIME_PER_SEC_SHIFT =37 , +VTIME_PER_SEC =1LLU <<VTIME_PER_SEC_SHIFT , +VTIME_PER_USEC =VTIME_PER_SEC /USEC_PER_SEC , +VTIME_PER_NSEC =VTIME_PER_SEC /NSEC_PER_SEC , + +/* bound vrate adjustments within two orders of magnitude */ +VRATE_MIN_PPM =10000 ,/* 1% */ +VRATE_MAX_PPM =100000000 ,/* 10000% */ + +VRATE_MIN =VTIME_PER_USEC *VRATE_MIN_PPM /MILLION , +VRATE_CLAMP_ADJ_PCT =4 , +}; +enum ioc_running {IOC_IDLE ,IOC_RUNNING ,
Signature · 1 line
2.39.0
Jiri Slaby
NAKQuoted 10 lines · Jiri Slaby (SUSE)
Since gcc13, each member of an enum has the same type as the enum [1]. And that is inherited from its members. Provided:
VTIME_PER_SEC_SHIFT= 37,
VTIME_PER_SEC= 1LLU <<VTIME_PER_SEC_SHIFT,
the named type is unsigned long.This generates warnings with gcc-13:
block/blk-iocost.c: In function 'ioc_weight_prfill':
block/blk-iocost.c:3037:37: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int'
Quoted 8 lines
block/blk-iocost.c: In function 'ioc_weight_show':
block/blk-iocost.c:3047:34: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int'So move the large VTIME values away to a separate enum, so that they don't affect other members. Move also VRATE ones as they depend on VTIME.
NACK
I forgot to remove the previous "casts" patch and the warning still triggers with this v2 alone. Let me do a v3 after finding the root cause.
Quoted 81 lines
Cc Martin Liska <[email protected]>Cc Tejun Heo <[email protected]>Cc Josef Bacik <[email protected]>Cc Jens Axboe <axboe-tSWWG44O7X1aa/[email protected]>Signed-off-by Jiri Slaby (SUSE) <[email protected]>---
Notes:
[v2] move to a new enumblock/blk-iocost.c | 48 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-)block/blk-iocost.c +25
-23@@ -233,29 +233,6 @@ enum {/* 1/64k is granular enough and can easily be handled w/ u32 */ WEIGHT_ONE =1 <<16 , -/* -* As vtime is used to calculate the cost of each IO, it needs to -* be fairly high precision. For example, it should be able to -* represent the cost of a single page worth of discard with -* suffificient accuracy. At the same time, it should be able to -* represent reasonably long enough durations to be useful and -* convenient during operation. -* -* 1s worth of vtime is 2^37. This gives us both sub-nanosecond -* granularity and days of wrap-around time even at extreme vrates. -*/ -VTIME_PER_SEC_SHIFT =37 , -VTIME_PER_SEC =1LLU <<VTIME_PER_SEC_SHIFT , -VTIME_PER_USEC =VTIME_PER_SEC /USEC_PER_SEC , -VTIME_PER_NSEC =VTIME_PER_SEC /NSEC_PER_SEC , - -/* bound vrate adjustments within two orders of magnitude */ -VRATE_MIN_PPM =10000 ,/* 1% */ -VRATE_MAX_PPM =100000000 ,/* 10000% */ - -VRATE_MIN =VTIME_PER_USEC *VRATE_MIN_PPM /MILLION , -VRATE_CLAMP_ADJ_PCT =4 , -/* if IOs end up waiting for requests, issue less */ RQ_WAIT_BUSY_PCT = 5,@@ -310,6 +287,31 @@ enum { LCOEF_RANDIO_PAGES = 4096, }; +enum { +/* +* As vtime is used to calculate the cost of each IO, it needs to +* be fairly high precision. For example, it should be able to +* represent the cost of a single page worth of discard with +* suffificient accuracy. At the same time, it should be able to +* represent reasonably long enough durations to be useful and +* convenient during operation. +* +* 1s worth of vtime is 2^37. This gives us both sub-nanosecond +* granularity and days of wrap-around time even at extreme vrates. +*/ +VTIME_PER_SEC_SHIFT =37 , +VTIME_PER_SEC =1LLU <<VTIME_PER_SEC_SHIFT , +VTIME_PER_USEC =VTIME_PER_SEC /USEC_PER_SEC , +VTIME_PER_NSEC =VTIME_PER_SEC /NSEC_PER_SEC , + +/* bound vrate adjustments within two orders of magnitude */ +VRATE_MIN_PPM =10000 ,/* 1% */ +VRATE_MAX_PPM =100000000 ,/* 10000% */ + +VRATE_MIN =VTIME_PER_USEC *VRATE_MIN_PPM /MILLION , +VRATE_CLAMP_ADJ_PCT =4 , +}; +enum ioc_running {IOC_IDLE ,IOC_RUNNING ,
Signature · 2 lines
js suse labs