Re: Make pg_stat_io view count IOs as bytes instead of blocks - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Make pg_stat_io view count IOs as bytes instead of blocks
Date
Msg-id Z4ixYkLGjh2ycUD5@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Make pg_stat_io view count IOs as bytes instead of blocks  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Make pg_stat_io view count IOs as bytes instead of blocks
List pgsql-hackers
Hi,

On Thu, Jan 16, 2025 at 12:47:17AM -0500, Tom Lane wrote:
> 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.

Thanks for the report and the proposed "fix".

From what I can see, the above proposal does (at least) silent the warning
here (clang 5.0.1 and same as demoiselle): https://godbolt.org/z/cGosfzGne (we
can see the warning by using the current define and that the warning is gone
with the new define).

Let's see on the BF.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Shinya Kato
Date:
Subject: Re: [PATCH] New predefined role pg_manage_extensions
Next
From: Michael Banck
Date:
Subject: Re: [PATCH] New predefined role pg_manage_extensions