From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:52260 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbeKIAkx (ORCPT ); Thu, 8 Nov 2018 19:40:53 -0500 Date: Thu, 8 Nov 2018 07:04:45 -0800 From: Christoph Hellwig To: Bart Van Assche Cc: Sagi Grimberg , Johannes Thumshirn , Jens Axboe , Linux Block Layer Mailinglist , Hannes Reinecke , Linux Kernel Mailinglist , Jan Kara Subject: Re: [PATCH] block: respect virtual boundary mask in bvecs Message-ID: <20181108150445.GA31100@infradead.org> References: <20181105102301.9752-1-jthumshirn@suse.de> <950a7996-e0f7-ff34-04da-47581a9496f0@grimberg.me> <1541607019.196084.210.camel@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1541607019.196084.210.camel@acm.org> Sender: linux-block-owner@vger.kernel.org List-Id: linux-block@vger.kernel.org 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 :)