Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp496834imu; Fri, 16 Nov 2018 05:54:09 -0800 (PST) X-Google-Smtp-Source: AJdET5dqwLJyMAvv+z0/+8up5+4uX1TdA0qSK0g3o7GtQf+sxe8MfDQRdDUcNOfbloBl6ro7eDIH X-Received: by 2002:a62:1896:: with SMTP id 144-v6mr11567249pfy.88.1542376448946; Fri, 16 Nov 2018 05:54:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542376448; cv=none; d=google.com; s=arc-20160816; b=OmqHf9aXbJrqbrR/tQOW2FMbTv2BlLFxDgYPdFQueocYOi5fcP5zhEpHCpQEMGvpbn FWZbLCbg9KBk+wzS76hTgTUmylM+8qP//CXZN7eO3I7DFvDN+DXhsEs4ALOj28q6m3ma 8mAOq5uKr31iqHpmiH5nnDlNNKe4oQVe1wYd1ThQUGVCXVJ8w9FKPUJbMQf+4EwmaslI CKgNu3X18MPQsQsKRJqUyulUjXqCuYpxp5loiin7YSeguMAOKwHbgP0D4vz4vmY/IGQx 6Ld71UT/OiIeJltkAwV0EHRlI+DQamzQ5/fSut6LW4wo30eS2Xs/sT0GNmxzeTOZIV7C eemw== 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=squSvI2nt++nj4zbnbw7tnrj3zf1hy1yOy0nlE9Hffs=; b=NWAzLBLjNuNqoWUflbKlisPUO1krypVgMhg1YoYJvrgG0l4GOBQ5SSqIy8NAVGC+hn e2X4UMoROxNXIage12gDu39oF5y0uKNF7yMrq1btm+E1RH1UhLLuBexckC2K8FsOJBM+ ROdryMAKPeGgO21/YwXDOlJ4Vqc6SOauWGDBEVs5rDE069BYv9mhH9iZ7UXLCAXcYnx7 4DswnJCBvna0HT6bxBqtsfvHchlldjvyZtPBWWrZvKSS9eqDD3ghYbuGekndj6cHz6r3 rSpCHA8GeDfcPrf5vz0umlqgpqg3OB3Nejb5u6JAKso4hSYtaRU7Uq9k9xa+HZbuXZIQ R5rw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si975051pfl.45.2018.11.16.05.53.54; Fri, 16 Nov 2018 05:54:08 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389822AbeKQAFl (ORCPT + 99 others); Fri, 16 Nov 2018 19:05:41 -0500 Received: from verein.lst.de ([213.95.11.211]:50051 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727727AbeKQAFl (ORCPT ); Fri, 16 Nov 2018 19:05:41 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id 7F57068D60; Fri, 16 Nov 2018 14:53:08 +0100 (CET) Date: Fri, 16 Nov 2018 14:53:08 +0100 From: Christoph Hellwig To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, linux-erofs@lists.ozlabs.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V10 14/19] block: enable multipage bvecs Message-ID: <20181116135308.GK3165@lst.de> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-15-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181115085306.9910-15-ming.lei@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > - > - if (page == bv->bv_page && off == bv->bv_offset + bv->bv_len) { > - bv->bv_len += len; > - bio->bi_iter.bi_size += len; > - return true; > - } > + struct request_queue *q = NULL; > + > + if (page == bv->bv_page && off == (bv->bv_offset + bv->bv_len) > + && (off + len) <= PAGE_SIZE) How could the page struct be the same, but the range beyond PAGE_SIZE (at least with the existing callers)? Also no need for the inner btraces, and the && always goes on the first line. > + if (bio->bi_disk) > + q = bio->bi_disk->queue; > + > + /* disable multi-page bvec too if cluster isn't enabled */ > + if (!q || !blk_queue_cluster(q) || > + ((page_to_phys(bv->bv_page) + bv->bv_offset + bv->bv_len) != > + (page_to_phys(page) + off))) > + return false; > + merge: > + bv->bv_len += len; > + bio->bi_iter.bi_size += len; > + return true; Ok, this is scary, as it will give differen results depending on when bi_disk is assigned. But then again we shouldn't really do the cluster check here, but rather when splitting the bio for the actual low-level driver. (and eventually we should kill this clustering setting off in favor of our normal segment limits).