Re: svn commit: r362667 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2020-06-26 Thread Warner Losh
On Fri, Jun 26, 2020, 9:04 PM Enji Cooper  wrote:

>
> > On Jun 26, 2020, at 6:02 PM, Alexey Dokuchaev  wrote:
> >
> > On Sat, Jun 27, 2020 at 12:57:48AM +, Matt Macy wrote:
> >> New Revision: 362667
> >> URL: https://svnweb.freebsd.org/changeset/base/362667
> >>
> >> Log:
> >>  Fix "current" variable name conflict with openzfs
> >>
> >>  The variable "current" is an alias for curthread
> >>  in openzfs. Rename all variable uses of current
> >>  in dtrace.c to curstate.
> >
> > Shouldn't OpenZFS be fixed instead?  The fact that we need to fix our
> > local variables suggests that they're abusing too generic name…
>
>
> I kind of agree with `current` being a bit too genericly named in
> both DTrace and OpenZFS :/..
>

It's always going to be something. These changes are actually pretty minor
and really only affect the part of the tree that uses Open Solaris
compatibility layer. These changes are smaller for us than changing all
OpenZFS. This really was the right fix.

Warner

>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362667 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2020-06-26 Thread Enji Cooper

> On Jun 26, 2020, at 6:02 PM, Alexey Dokuchaev  wrote:
> 
> On Sat, Jun 27, 2020 at 12:57:48AM +, Matt Macy wrote:
>> New Revision: 362667
>> URL: https://svnweb.freebsd.org/changeset/base/362667
>> 
>> Log:
>>  Fix "current" variable name conflict with openzfs
>> 
>>  The variable "current" is an alias for curthread
>>  in openzfs. Rename all variable uses of current
>>  in dtrace.c to curstate.
> 
> Shouldn't OpenZFS be fixed instead?  The fact that we need to fix our
> local variables suggests that they're abusing too generic name…


I kind of agree with `current` being a bit too genericly named in both 
DTrace and OpenZFS :/..
Cheers,
-Enji

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362667 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2020-06-26 Thread Alexey Dokuchaev
On Sat, Jun 27, 2020 at 12:57:48AM +, Matt Macy wrote:
> New Revision: 362667
> URL: https://svnweb.freebsd.org/changeset/base/362667
> 
> Log:
>   Fix "current" variable name conflict with openzfs
>   
>   The variable "current" is an alias for curthread
>   in openzfs. Rename all variable uses of current
>   in dtrace.c to curstate.

Shouldn't OpenZFS be fixed instead?  The fact that we need to fix our
local variables suggests that they're abusing too generic name...

./danfe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362667 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2020-06-26 Thread Matt Macy
Author: mmacy
Date: Sat Jun 27 00:57:48 2020
New Revision: 362667
URL: https://svnweb.freebsd.org/changeset/base/362667

Log:
  Fix "current" variable name conflict with openzfs
  
  The variable "current" is an alias for curthread
  in openzfs. Rename all variable uses of current
  in dtrace.c to curstate.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cSat Jun 
27 00:55:03 2020(r362666)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cSat Jun 
27 00:57:48 2020(r362667)
@@ -2780,25 +2780,25 @@ static int
 dtrace_speculation(dtrace_state_t *state)
 {
int i = 0;
-   dtrace_speculation_state_t current;
+   dtrace_speculation_state_t curstate;
uint32_t *stat = >dts_speculations_unavail, count;
 
while (i < state->dts_nspeculations) {
dtrace_speculation_t *spec = >dts_speculations[i];
 
-   current = spec->dtsp_state;
+   curstate = spec->dtsp_state;
 
-   if (current != DTRACESPEC_INACTIVE) {
-   if (current == DTRACESPEC_COMMITTINGMANY ||
-   current == DTRACESPEC_COMMITTING ||
-   current == DTRACESPEC_DISCARDING)
+   if (curstate != DTRACESPEC_INACTIVE) {
+   if (curstate == DTRACESPEC_COMMITTINGMANY ||
+   curstate == DTRACESPEC_COMMITTING ||
+   curstate == DTRACESPEC_DISCARDING)
stat = >dts_speculations_busy;
i++;
continue;
}
 
if (dtrace_cas32((uint32_t *)>dtsp_state,
-   current, DTRACESPEC_ACTIVE) == current)
+   curstate, DTRACESPEC_ACTIVE) == curstate)
return (i + 1);
}
 
@@ -2827,7 +2827,7 @@ dtrace_speculation_commit(dtrace_state_t *state, proce
dtrace_speculation_t *spec;
dtrace_buffer_t *src, *dest;
uintptr_t daddr, saddr, dlimit, slimit;
-   dtrace_speculation_state_t current, new = 0;
+   dtrace_speculation_state_t curstate, new = 0;
intptr_t offs;
uint64_t timestamp;
 
@@ -2844,12 +2844,12 @@ dtrace_speculation_commit(dtrace_state_t *state, proce
dest = >dts_buffer[cpu];
 
do {
-   current = spec->dtsp_state;
+   curstate = spec->dtsp_state;
 
-   if (current == DTRACESPEC_COMMITTINGMANY)
+   if (curstate == DTRACESPEC_COMMITTINGMANY)
break;
 
-   switch (current) {
+   switch (curstate) {
case DTRACESPEC_INACTIVE:
case DTRACESPEC_DISCARDING:
return;
@@ -2891,7 +2891,7 @@ dtrace_speculation_commit(dtrace_state_t *state, proce
ASSERT(0);
}
} while (dtrace_cas32((uint32_t *)>dtsp_state,
-   current, new) != current);
+   curstate, new) != curstate);
 
/*
 * We have set the state to indicate that we are committing this
@@ -2907,7 +2907,7 @@ dtrace_speculation_commit(dtrace_state_t *state, proce
/*
 * We have sufficient space to copy the speculative buffer into the
 * primary buffer.  First, modify the speculative buffer, filling
-* in the timestamp of all entries with the current time.  The data
+* in the timestamp of all entries with the curstate time.  The data
 * must have the commit() time rather than the time it was traced,
 * so that all entries in the primary buffer are in timestamp order.
 */
@@ -2970,8 +2970,8 @@ out:
 * If we're lucky enough to be the only active CPU on this speculation
 * buffer, we can just set the state back to DTRACESPEC_INACTIVE.
 */
-   if (current == DTRACESPEC_ACTIVE ||
-   (current == DTRACESPEC_ACTIVEONE && new == DTRACESPEC_COMMITTING)) {
+   if (curstate == DTRACESPEC_ACTIVE ||
+   (curstate == DTRACESPEC_ACTIVEONE && new == DTRACESPEC_COMMITTING)) 
{
uint32_t rval = dtrace_cas32((uint32_t *)>dtsp_state,
DTRACESPEC_COMMITTING, DTRACESPEC_INACTIVE);
 
@@ -2994,7 +2994,7 @@ dtrace_speculation_discard(dtrace_state_t *state, proc
 dtrace_specid_t which)
 {
dtrace_speculation_t *spec;
-   dtrace_speculation_state_t current, new = 0;
+   dtrace_speculation_state_t curstate, new = 0;
dtrace_buffer_t *buf;
 
if (which == 0)
@@ -3009,9 +3009,9 @@ dtrace_speculation_discard(dtrace_state_t *state, proc
buf = >dtsp_buffer[cpu];
 
do {
-   current = spec->dtsp_state;
+