From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751464AbdJSXho (ORCPT ); Thu, 19 Oct 2017 19:37:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37692 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750899AbdJSXhm (ORCPT ); Thu, 19 Oct 2017 19:37:42 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DE2E8C0587F7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ming.lei@redhat.com Date: Fri, 20 Oct 2017 07:37:32 +0800 From: Ming Lei To: Christoph Hellwig Cc: Jens Axboe , Huang Ying , Andrew Morton , Alexander Viro , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 20/49] block: introduce bio_for_each_segment_mp() Message-ID: <20171019233731.GD27130@ming.t460p> References: <20170808084548.18963-1-ming.lei@redhat.com> <20170808084548.18963-21-ming.lei@redhat.com> <20170810121110.GC14607@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170810121110.GC14607@infradead.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 19 Oct 2017 23:37:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 10, 2017 at 05:11:10AM -0700, Christoph Hellwig wrote: > First: as mentioned in the previous patches I really hate the name > scheme with the _sp and _mp postfixes. > > To be clear and understandable we should always name the versions > that iterate over segments *segment* and the ones that iterate over > pages *page*. To make sure we have a clean compile break for code > using the old _segment name I'd suggest to move to pass the bvec_iter > argument by reference, which is the right thing to do anyway. The most confusing thing is that bio_for_each_segment() and bio_for_each_segment_all() has been used to iterate pages for long time. That is why I add _sp/_mp in this patchset to make the uses explicitly and avoid to confuse people. My plan is to switch to the real bio_for_each_segment() for iterating real segment and bio_for_each_page() for iterating page after we reach mutlipage bvec, and that is basically a mechanical change. > As far as the implementation goes I don't think we actually need > to pass the mp argument down. Instead we always call the full-segment > version of bvec_iter_len / __bvec_iter_advance and then have an > inner loop that moves the fake bvecs forward inside each full-segment > one - that is implement the per-page version on top of the per-segment > one. For iterating in way of real segment(multipage bvec) instead of page, we don't need the inner loop for moving page by page to the fake bvec, that is why the 'mp' argument is introduced. If this argument is dropped, we have to find another similar way to decide to fetch one segment or one page each time. -- Ming