Skip to content

Commit ff1cc97

Browse files
Jiri Slaby (SUSE)axboe
authored andcommitted
block/blk-iocost (gcc13): keep large values in 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, ... AUTOP_CYCLE_NSEC = 10LLU * NSEC_PER_SEC, 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 split the anonymous enum with large values to a separate enum, so that they don't affect other members. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113 Cc: Martin Liska <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Josef Bacik <[email protected]> Cc: Jens Axboe <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 337366e commit ff1cc97

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

block/blk-iocost.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ enum {
232232

233233
/* 1/64k is granular enough and can easily be handled w/ u32 */
234234
WEIGHT_ONE = 1 << 16,
235+
};
235236

237+
enum {
236238
/*
237239
* As vtime is used to calculate the cost of each IO, it needs to
238240
* be fairly high precision. For example, it should be able to

0 commit comments

Comments
 (0)