Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3221216imu; Sat, 24 Nov 2018 00:26:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wa1FRYbHVQVpywGHWePnIHxdefx2+7U6SoftSZWNnU+TJMmQ4FhNcvctNjhsxuBZB3Iiga X-Received: by 2002:a63:ca0a:: with SMTP id n10mr17268737pgi.258.1543047970129; Sat, 24 Nov 2018 00:26:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047970; cv=none; d=google.com; s=arc-20160816; b=uST6vekaL/aIN8OEO4MJPbGSy82LMvmqi9QR5ttuX6znHdPPNNh+XgdLOkAGpARv0s CY2765qtjFT3ZJImAoietjtJd+J/Uq/190HTiBK5UoLopOUfmQdktBozQednvDFM1zCy aestZCD/b10L9hWLX6nDOIlFyO32Bm3wRx7LseiMQMN8cCVPm66EKOlf6Mr48wkOCvZM BVhx8uTi2iF5y90bOLJb+GnlmwHBrKw6htbEYpmkjMh45XNpo4iHriTcCm/CnqGPeHky fIzP0ctfk36MBJSwgsf2/hR4sv0F/mdwC7ZDeom2DG/6mQ6oswqprlXCqew/VQ4tDivx QJJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jkFy+yP0A6UkRLq16MIjBr5blyXVMnzNB7jndNKm1JI=; b=c0oOrIhN81QFJV1ucHrlWeLmD7ulq0FpODXF0lRVjvXzQrU47u1wHQVHMsm+ynl4KE YM03jxdjFwftSDdPvFssELvsL0+6pMJkJRiXqb8nmHwhB5HzOI+Th89c5jiIvDgWd2Z8 JPd4wUZT5ftiVtv1ZqApNhjnPIYIwVhonmvswVD6Nup+LvD+Uvq4MqlLh+sfaB7yhoUp uap5fS7egvkjSDVDJyGAi8ihXogy03zQSHCoSc3OUBnKP+ZmsRT1xbvNCFYeCYbleKBF N98OsTSwVovB0Id5/Fkq5/dmcg73N6VAk1LRb62Vl95Sr+ldYqUvdMfdapmmZ3PhlqX7 TIDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f61si19227417plb.51.2018.11.24.00.25.56; Sat, 24 Nov 2018 00:26:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503520AbeKWVev (ORCPT + 99 others); Fri, 23 Nov 2018 16:34:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59014 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503502AbeKWVeu (ORCPT ); Fri, 23 Nov 2018 16:34:50 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2809C050DFB; Fri, 23 Nov 2018 10:51:02 +0000 (UTC) Received: from ming.t460p (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E76FD1054FDC; Fri, 23 Nov 2018 10:50:33 +0000 (UTC) Date: Fri, 23 Nov 2018 18:50:26 +0800 From: Ming Lei To: Christoph Hellwig Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , Omar Sandoval , Sagi Grimberg , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V11 15/19] block: enable multipage bvecs Message-ID: <20181123105024.GA13902@ming.t460p> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181121161206.GD4977@lst.de> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 23 Nov 2018 10:51:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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