Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S947083AbcJaXvd (ORCPT ); Mon, 31 Oct 2016 19:51:33 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:34485 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S946934AbcJaXvb (ORCPT ); Mon, 31 Oct 2016 19:51:31 -0400 MIME-Version: 1.0 In-Reply-To: References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> <1477728600-12938-46-git-send-email-tom.leiming@gmail.com> <20161031135943.36crigad55hwmmrl@thunk.org> From: Ming Lei Date: Tue, 1 Nov 2016 07:51:27 +0800 Message-ID: Subject: Re: [PATCH 45/60] block: bio: introduce bio_for_each_segment_all_rd() and its write pair To: "Theodore Ts'o" , Ming Lei , Jens Axboe , Linux Kernel Mailing List , linux-block , Linux FS Devel , Christoph Hellwig , "Kirill A . Shutemov" , Mike Christie , Hannes Reinecke , Keith Busch , Mike Snitzer , Johannes Thumshirn , Bart Van Assche Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1638 Lines: 42 On Tue, Nov 1, 2016 at 6:46 AM, Ming Lei wrote: > On Mon, Oct 31, 2016 at 9:59 PM, Theodore Ts'o wrote: >> On Sat, Oct 29, 2016 at 04:08:44PM +0800, Ming Lei wrote: >>> This patches introduce bio_for_each_segment_all_rd() and >>> bio_for_each_segment_all_wt(). >>> >>> bio_for_each_segment_all_rd() is for replacing >>> bio_for_each_segment_all() in case the bvec from bio->bi_io_vec >>> is accessed as readonly. >>> >>> bio_for_each_segment_all_wt() is for replacing >>> bio_for_each_segment_all() in case the bvec from bio->bi_io_vec >>> need to be updated. >> >> What is _rd and _wt supposed to stand for? And speaking more > > As Christoph replied, _rd means read, which said the bvec pointed by > the iterator variable(bvec pointer) is read-only, and the bvec table > can't be written into via this usage any more. Maybe > bio_for_each_segment_all_ro is better? Sorry for forgetting to mention one important point: - after multipage bvec is introduced, the iterated bvec pointer still points to singlge page bvec, which is generated in-flight and is readonly actually. That is the motivation about the introduction of bio_for_each_segment_all_rd(). So maybe bio_for_each_page_all_ro() is better? > > On the other hand, _wr meands write, which said the bvec pointed by > the iterator variable(bvec pointer) can be written to. Maybe we can use > original bio_for_each_segment_all() for it? For _wt(), we still can keep it as bio_for_each_segment(), which also reflects that now the iterated bvec points to one whole segment if we name _rd as bio_for_each_page_all_ro(). Thanks, Ming Lei