Re: [PATCH 2/7] xfs: convert btree cursor ag private member name

Dave Chinner
2020-03-05T02:43:34Z

On Wed, Mar 04, 2020 at 06:31:41PM -0800, Darrick J. Wong wrote:
> On Thu, Mar 05, 2020 at 12:45:32PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > bc_private.a -> bc_ag conversion via script:
> >
> > `sed -i 's/bc_private\.a/bc_ag/g' fs/xfs/*[ch] fs/xfs/*/*[ch]`
>
> Just out of curiosity, does the following cocci script do this more
> cleanly:
>
> @@
> expression cur
> @@
>
> - cur->bc_private.a
> + cur->bc_ag
>
> <EOF>
>
> Coccinelle does know how to do some kernel-style cleanups of the lines
> it touches, though I admit that the spatch format is /really/ hard to
> understand (and I barely grok it). When it works, it's a wonderful
> refactoring tool.

No idea. I don't understand the cocci syntax, and I'm not about to
audit 250+ automated changes to see if it does anything different to
a simple sed regex. Nor am I expecting reviewers to manually check
every single one of these conversions - I expect them to understand
what basic unix tools sed and regexes do and be able to extrapolate
from there. :)

And, really, I don't want to have to sink an hour or two into making
some tool I have no idea how to use to do what took me about 10s to
implement and execute. Indeed, I don't even have cocci installed on
any of my machines, so I'd be starting from "how the hell do I even
run this thing"....

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com