From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ming Lei Date: Fri, 23 Nov 2018 18:50:26 +0800 Subject: [Cluster-devel] [PATCH V11 15/19] block: enable multipage bvecs In-Reply-To: <20181121161206.GD4977@lst.de> References: <20181121032327.8434-1-ming.lei@redhat.com> <20181121032327.8434-16-ming.lei@redhat.com> <20181121145502.GA3241@lst.de> <20181121154812.GD19111@ming.t460p> <20181121161206.GD4977@lst.de> Message-ID: <20181123105024.GA13902@ming.t460p> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, Nov 21, 2018 at 05:12:06PM +0100, Christoph Hellwig wrote: > On Wed, Nov 21, 2018 at 11:48:13PM +0800, Ming Lei wrote: > > I guess the correct check should be: > > > > end_addr = vec_addr + bv->bv_offset + bv->bv_len; > > if (same_page && > > (end_addr & PAGE_MASK) != (page_addr & PAGE_MASK)) > > return false; > > Indeed. The above is still not totally correct, and it should have been: end_addr = vec_addr + bv->bv_offset + bv->bv_len - 1; if (same_page && (end_addr & PAGE_MASK) != page_addr) return false; Also bv->bv_len should be guaranteed as being bigger than zero. It also shows that it is quite easy to figure out the last page as wrong, :-( Thanks, Ming