Re: [PATCH] btrfs: cleanup for open-coded alignment

David Sterba
Thu, 28 Feb 2013 12:40:08 -0000

On Thu, Feb 28, 2013 at 08:50:37AM +0800, Qu Wenruo
wrote:
> >I have covered all cases in my original patch with a coccinelle
semantic
> >patch http://www.spinics.net/lists/linux-btrfs/msg12750.html and also
> >removed the useless stripe_align helper and updated it''s
callers (and it
> >still applies after merging the raid56 code that updated the function
> >with 2 unused arguments).
> Thanks for pointing out the original rules.
> The orginal rules is pretty good but can only
> deal with the open-coded alignment in one line.
>
> If there is something using varient "mask",
> the rules seems no help like the following:
> ------
>
>         u64 mask = ((u64)root->stripesize - 1);
>         u64 ret = (val + mask) & ~mask;

You''re right, the semantic patch does not cover that, so
you''ve found
more cases in the end, that''s good.

> And sorry for the wrong signed-off, it seems that I''m using one of
your
> deprecated mail address.

Still active, but I prefer to use the $job one.

david