Re: Make pg_stat_io view count IOs as bytes instead of blocks

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Melanie Plageman <melanieplageman@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-01-16T05:47:17Z
Lists: pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> Not completely sure about the number of parenthesis, but I hope that
> this should be enough (extra set around io_op):
> +#define pgstat_is_ioop_tracked_in_bytes(io_op) \
> +	(((unsigned int) (io_op)) < IOOP_NUM_TYPES && \
> +	 ((unsigned int) (io_op)) >= IOOP_EXTEND)

Yeah, that's safe parenthesis-wise.  Whether it'll silence
the warning from those old clangs remains to be seen.

(But if it doesn't, maybe it's not worth working harder,
given that they're old.)

			regards, tom lane



Commits

  1. Rework macro pgstat_is_ioop_tracked_in_bytes()

  2. Remove assertion in pgstat_count_io_op()

  3. Make pg_stat_io count IOs as bytes instead of blocks for some operations

  4. Merge pgstat_count_io_op_n() and pgstat_count_io_op()