[DTrace-devel] [PATCH 47/61] Clean up latch sequence number

Kris Van Hees kris.van.hees at oracle.com
Mon Aug 15 03:46:06 UTC 2022


On Fri, Jul 08, 2022 at 10:45:31AM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> We were checking multiple times whether it was 0.  Have
> dt_agg_one_agg() take a pointer to actual data without regard
> to latch sequence number.

I agree that doing the check in dt_aggregate_snap_one() is sufficient and thus
there is no need to have that check in dt_agg_one_agg().  But I would retain
the passing in of the base pointer for the data and have dt_agg_one_agg deal
with the latch sequence number as needed.  With my modified record description
changes, the full data needs to be passed in because the stored data needs to
be accessible at the offsets that are in the record descriptions.

> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

... with changes as outlined below (and adapted for modified aggdesc/recdesc)
... queued for dev

> ---
>  libdtrace/dt_aggregate.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/libdtrace/dt_aggregate.c b/libdtrace/dt_aggregate.c
> index 191aef52..8fa2755d 100644
> --- a/libdtrace/dt_aggregate.c
> +++ b/libdtrace/dt_aggregate.c
> @@ -421,10 +421,6 @@ dt_agg_one_agg(uint_t act, int64_t *dst, int64_t *src, uint_t realsz)
>  {
>  	uint_t i, cnt;
>  
> -	if (*src == 0)
> -		return;
> -
> -	src++;  /* skip latch sequence number */

Instead:
	*dst++ = *src++;

>  	switch (act) {
>  	case DT_AGG_MAX:
>  		if (*src > *dst)
> @@ -471,6 +467,9 @@ dt_aggregate_snap_one(dt_idhash_t *dhp, dt_ident_t *aid, dt_snapstate_t *st)
>  	if (*src == 0)
>  		return 0;
>  
> +	/* advance past the latch sequence number */
> +	src++;

Do not advance src.

> +
>  	datasz = agg->dtagd_recs[nrecs - 1].dtrd_size;

This is now:
	datasz = agg->dtagd_dsize;

>  
>  	/* See if we already have an entry for this aggregation. */
> @@ -496,13 +495,6 @@ dt_aggregate_snap_one(dt_idhash_t *dhp, dt_ident_t *aid, dt_snapstate_t *st)
>  		return 0;
>  	}
>  
> -	/* not found, so skip it if latch sequence number is 0 */
> -	if (*src == 0)
> -		return 0;
> -
> -	/* advance past the latch sequence number */
> -	src++;

Do not advance src.

> -
>  	/* add it to the hash table */
>  	h = dt_zalloc(st->dtp, sizeof(dt_ahashent_t));
>  	if (h == NULL)
> -- 
> 2.18.4
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list