From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20AA0C4161B for ; Mon, 19 Nov 2018 08:24:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF2FE20684 for ; Mon, 19 Nov 2018 08:24:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF2FE20684 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-btrfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727014AbeKSSrL (ORCPT ); Mon, 19 Nov 2018 13:47:11 -0500 Received: from verein.lst.de ([213.95.11.211]:36660 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbeKSSrL (ORCPT ); Mon, 19 Nov 2018 13:47:11 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id 8B0BF68B02; Mon, 19 Nov 2018 09:24:14 +0100 (CET) Date: Mon, 19 Nov 2018 09:24:14 +0100 From: Christoph Hellwig To: Ming Lei Cc: Christoph Hellwig , 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 , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com, Chandan Rajendra Subject: Re: [PATCH V10 08/19] btrfs: move bio_pages_all() to btrfs Message-ID: <20181119082414.GA10678@lst.de> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-9-ming.lei@redhat.com> <20181116133845.GG3165@lst.de> <20181119081922.GB16736@ming.t460p> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181119081922.GB16736@ming.t460p> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Mon, Nov 19, 2018 at 04:19:24PM +0800, Ming Lei wrote: > On Fri, Nov 16, 2018 at 02:38:45PM +0100, Christoph Hellwig wrote: > > On Thu, Nov 15, 2018 at 04:52:55PM +0800, Ming Lei wrote: > > > BTRFS is the only user of this helper, so move this helper into > > > BTRFS, and implement it via bio_for_each_segment_all(), since > > > bio->bi_vcnt may not equal to number of pages after multipage bvec > > > is enabled. > > > > btrfs only uses the value to check if it is larger than 1. No amount > > of multipage bio merging should ever make bi_vcnt go from 0 to 1 or > > vice versa. > > Could you explain a bit why? > > Suppose 2 physically continuous pages are added to this bio, .bi_vcnt > can be 1 in case of multi-page bvec, but it is 2 in case of single-page > bvec. True, I did think of 0 vs 1. The magic here in btrfs still doesn't make much sense. The comments down in btrfs_check_repairable talk about sectors, so it might be a leftover from the blocksize == PAGE_SIZE days (assuming those patches actually got merged). I'd like to have the btrfs folks chime in, but in the end we should probably check if the bio was larger than a single sector here.