Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3656452imm; Fri, 25 May 2018 09:17:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxySIGk4lMqfZyOXT3J0nEntEor9RSl2w/OSRX509Ovnsf+dOKZnzxX8snWIahJrA5I3U8 X-Received: by 2002:a62:f24a:: with SMTP id y10-v6mr3235847pfl.75.1527265028179; Fri, 25 May 2018 09:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527265028; cv=none; d=google.com; s=arc-20160816; b=pz0Ss2CJOlx37rqp2EG6kLJUGXRY85thv4k8IRaszUxSX0QN3jP5o9HKkemIwhYdEq TSIjD0dMuiSu43t6tYek57jFJ8g3svNOF3Uii9Ttxz7+T7odq5vtkVLag/ZK1xcTfvjO EaipE2iKhjDuKP2L34vFBFncD2mf7bp+Wq5iDTjNQWQY3lRVwwr/lGQyI/MNSWKooa6n 2pdvxV0qsLmK0WUvi/Hk/EhFOfsZKpbAw7Z+PY78N9IsdZZpqfbHKGYsIcz1tYB8rqp0 a1eGZt6L7nJ89owAUQ2v7EOqZnIxkEKUreSr7EY7Yv90LUPWvCiStjH1GRNOaUDXAz0D FQ7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=kpvFfffMuZshhTKjgUDPBBXtc6hTfhoBN4O9vzqSAJg=; b=FHpvmkeMRyL4AeDQ54nG//6C0P4MTPdt4pEQw5orp2EgR9C9CjcNhrii0MJZcLUUki gP05RtCyG9icm7v6gnKJhVIB+cocRfYllkzG9MpvbY0WHwHtYsNv8P2p1V7uNX2Od2sZ 7KeGb+OdTpaOSbBDoPqGhrKLVxkOGb8is1YG02a+NUBgBagJdVB69Idpkm69iAmGZ2z5 oriyvUDR/983SahHcJnrCO5d/jUvJdPt2t4cKiKnJatFezr1AZYVmCuhLT8LYniy9hR1 tOhPv1KaeiP4BFijBR5ewUqr1sy68/j8MdH0kvJ/id41q2Z4gIhlgGsg8MSJMR+0GBWL qPHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=r0kIqYRz; 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 24-v6si24525152pfp.161.2018.05.25.09.16.52; Fri, 25 May 2018 09:17:08 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=r0kIqYRz; 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 S967186AbeEYQQe (ORCPT + 99 others); Fri, 25 May 2018 12:16:34 -0400 Received: from merlin.infradead.org ([205.233.59.134]:39292 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966725AbeEYQQb (ORCPT ); Fri, 25 May 2018 12:16:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kpvFfffMuZshhTKjgUDPBBXtc6hTfhoBN4O9vzqSAJg=; b=r0kIqYRz6xtNBnCXal+kWUkKSa YPWFRa3HB+2nRM1zCtRE0cWGxuNaq/rorN+LneKyMB5tUkwmW6bQYqinWvrTQwZmkTcfTDAC7cPlZ eLsjBenmHHO71T8dB6615FsV9gP2fEkumpSHLRwJVyINBkiG9X9K07p6c5B/NNmY0C5xFrQ2Nv4cG xbp3jIW2tNWrqP/MxCMgxz52eSY7XT+0xpy857tLCkslyAsCmsrOtQSJrGgbFU++gGWl5Qm4+tRdR 9TWfsdDBGKLI6TLii0CNRGHKAsy8KqeuoslPICTNYsC5q3RRVPldB5VSR3p4MXG6Tdn2/TGjmXdNM vN3Zx4xg==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMFO1-0005qF-LV; Fri, 25 May 2018 16:16:14 +0000 Subject: Re: [RESEND PATCH V5 33/33] block: document usage of bio iterator helpers To: Ming Lei , Jens Axboe , Christoph Hellwig , Alexander Viro , Kent Overstreet Cc: David Sterba , Huang Ying , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , "Darrick J . Wong" , Coly Li , Filipe Manana References: <20180525034621.31147-1-ming.lei@redhat.com> <20180525034621.31147-34-ming.lei@redhat.com> From: Randy Dunlap Message-ID: <00b2a0e5-431c-1fc3-7cc8-602148c56457@infradead.org> Date: Fri, 25 May 2018 09:16:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180525034621.31147-34-ming.lei@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/24/2018 08:46 PM, Ming Lei wrote: > Now multipage bvec is supported, and some helpers may return page by > page, and some may return segment by segment, this patch documents the > usage for helping us use them correctly. > > Signed-off-by: Ming Lei > --- > Documentation/block/biovecs.txt | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/Documentation/block/biovecs.txt b/Documentation/block/biovecs.txt > index b4d238b8d9fc..32a6643caeca 100644 > --- a/Documentation/block/biovecs.txt > +++ b/Documentation/block/biovecs.txt > @@ -117,3 +117,35 @@ Other implications: > size limitations and the limitations of the underlying devices. Thus > there's no need to define ->merge_bvec_fn() callbacks for individual block > drivers. > + > +Usage of helpers: > +================= > + > +* The following helpers which name has suffix of "_all" can only be used on * The following helpers, whose names have the suffix "_all", can only be used on > +non-BIO_CLONED bio, and ususally they are used by filesystem code, and driver usually > +shouldn't use them becasue bio may have been splitted before they got to the because split > +driver: > + > + bio_for_each_segment_all() > + bio_for_each_page_all() > + bio_pages_all() > + bio_first_bvec_all() > + bio_first_page_all() > + bio_last_bvec_all() > + segment_for_each_page_all() > + > +* The following helpers iterate bio page by page, and the local variable of > +'struct bio_vec' or the reference records single page io vector during the > +itearation: iteration: > + > + bio_for_each_page() > + bio_for_each_page_all() > + segment_for_each_page_all() > + > +* The following helpers iterate bio segment by segment, and each segment may > +include multiple physically contiguous pages, and the local variable of > +'struct bio_vec' or the reference records multi page io vector during the > +itearation: iteration: > + > + bio_for_each_segment() > + bio_for_each_segment_all() > -- ~Randy