Re: [PATCH] block: respect virtual boundary mask in bvecs
From: Christoph Hellwig
Date: Thu Nov 08 2018 - 10:05:01 EST
On Wed, Nov 07, 2018 at 08:10:19AM -0800, Bart Van Assche wrote:
> > I personally not a huge fan of decoding complicated expressions. But if
> > others are fine with it then I am too...
>
> What I proposed is not a new pattern. It is a pattern that is already used
> elsewhere in the Linux kernel. A few examples:
>
> >From dmabounce.c:
>
> /* Figure out if we need to bounce from the DMA mask. */
> if ((dma_addr | (dma_addr + size - 1)) & ~mask)
> return 1;
>
> >From dma-direct.h:
>
> if ((addr | (addr + size - 1)) & ~mask)
> return 0;
Time for a well documented helper :)