Re: [PATCH v4 07/11] perf auxtrace: Remove auxtrace_mmap__read_snapshot_head()
From: Leo Yan
Date: Tue Jul 13 2021 - 09:10:29 EST
On Mon, Jul 12, 2021 at 05:32:11PM +0300, Adrian Hunter wrote:
[...]
> > --- a/tools/perf/util/auxtrace.c
> > +++ b/tools/perf/util/auxtrace.c
> > @@ -1686,13 +1686,12 @@ static int __auxtrace_mmap__read(struct mmap *map,
> > union perf_event ev;
> > void *data1, *data2;
> >
> > + head = auxtrace_mmap__read_head(mm);
> > +
> > if (snapshot) {
> > - head = auxtrace_mmap__read_snapshot_head(mm);
> > if (auxtrace_record__find_snapshot(itr, mm->idx, mm, data,
> > &head, &old))
>
> That leaves a nested 'if' which is not kernel style i.e. could be
>
> if (snapshot &&
> auxtrace_record__find_snapshot(itr, mm->idx, mm, data, &head, &old))
Will refine in next spin, thanks for suggestion!
> > return -1;
> > - } else {
> > - head = auxtrace_mmap__read_head(mm);
> > }
> >
> > if (old == head)