Skip to content

Commit 7b6468c

Browse files
committed
Rework macro pgstat_is_ioop_tracked_in_bytes()
As written, it was triggering a compilation warning for old versions of clang, as reported by buildfarm members ayu, batfish and demoiselle. Forcing a cast with "unsigned int" should fix the warning. While on it, the macro is moved to pgstat.h, closer to the declaration of IOOp, per suggestion from Tom Lane. Reported-by: Tom Lane Reviewed-by: Bertrand Drouvot, Tom Lane, Nazir Bilal Yavuz Discussion: https://postgr.es/m/1272824.1736961543@sss.pgh.pa.us
1 parent d4a43b2 commit 7b6468c

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/backend/utils/activity/pgstat_io.c

-8
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@
2323
static PgStat_PendingIO PendingIOStats;
2424
static bool have_iostats = false;
2525

26-
/*
27-
* Check if an IOOp is tracked in bytes. This relies on the ordering of IOOp
28-
* defined in pgstat.h, so make sure to update this check when changing its
29-
* elements.
30-
*/
31-
#define pgstat_is_ioop_tracked_in_bytes(io_op) \
32-
((io_op) < IOOP_NUM_TYPES && (io_op) >= IOOP_EXTEND)
33-
3426
/*
3527
* Check that stats have not been counted for any combination of IOObject,
3628
* IOContext, and IOOp which are not tracked for the passed-in BackendType. If

src/include/pgstat.h

+4
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ typedef enum IOOp
314314

315315
#define IOOP_NUM_TYPES (IOOP_WRITE + 1)
316316

317+
#define pgstat_is_ioop_tracked_in_bytes(io_op) \
318+
(((unsigned int) (io_op)) < IOOP_NUM_TYPES && \
319+
((unsigned int) (io_op)) >= IOOP_EXTEND)
320+
317321
typedef struct PgStat_BktypeIO
318322
{
319323
uint64 bytes[IOOBJECT_NUM_TYPES][IOCONTEXT_NUM_TYPES][IOOP_NUM_TYPES];

0 commit comments

Comments
 (0)