diff --git a/src/backend/utils/activity/pgstat_io.c b/src/backend/utils/activity/pgstat_io.c
index e03b021af3..12d54d5c4a 100644
--- a/src/backend/utils/activity/pgstat_io.c
+++ b/src/backend/utils/activity/pgstat_io.c
@@ -23,14 +23,6 @@
 static PgStat_PendingIO PendingIOStats;
 static bool have_iostats = false;
 
-/*
- * Check if an IOOp is tracked in bytes.  This relies on the ordering of IOOp
- * defined in pgstat.h, so make sure to update this check when changing its
- * elements.
- */
-#define pgstat_is_ioop_tracked_in_bytes(io_op) \
-	((io_op) < IOOP_NUM_TYPES && (io_op) >= IOOP_EXTEND)
-
 /*
  * Check that stats have not been counted for any combination of IOObject,
  * IOContext, and IOOp which are not tracked for the passed-in BackendType. If
@@ -78,7 +70,8 @@ pgstat_count_io_op(IOObject io_object, IOContext io_context, IOOp io_op,
 {
 	Assert((unsigned int) io_object < IOOBJECT_NUM_TYPES);
 	Assert((unsigned int) io_context < IOCONTEXT_NUM_TYPES);
-	Assert(pgstat_is_ioop_tracked_in_bytes(io_op) || bytes == 0);
+	Assert(((unsigned int) io_op < IOOP_NUM_TYPES &&
+			(unsigned int) io_op >= IOOP_EXTEND) || bytes == 0);
 	Assert(pgstat_tracks_io_op(MyBackendType, io_object, io_context, io_op));
 
 	if (pgstat_tracks_backend_bktype(MyBackendType))
