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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
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:13:08Z
Lists: pgsql-hackers

Attachments

On Wed, Jan 15, 2025 at 11:34:14PM -0500, Tom Lane wrote:
> Michael Paquier <michael@paquier.xyz> writes:
> > I cannot reproduce that, perhaps I'm just missing something with these
> > switches.  Do you think that a cast would cool things?  Please see the
> > attached for the idea.
> 
> There are only three animals showing this warning (ayu, batfish,
> demoiselle) so it likely requires particular clang versions
> as well as the right -W switches.

All of them on ppc with clang 4 or 5.  That's dated.  :)

> Maybe a cast would silence it, but your draft seems
> underparenthesized.  (Which raises the question of whether we
> should be using a macro for this at all --- probably there's
> not much risk of double-evaluation being a problem, but a
> static inline would remove the risk.)

Just for an assert, I would just remove the macro rather than have an
inline function.
--
Michael

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()