Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1979312imm; Sat, 9 Jun 2018 05:38:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLITTEcYMteuKkV97BAjonSTj1SLWDy8KC0wx3RT18x6oxA2e3rXyGJKIWuXeoSdhjZAiIm X-Received: by 2002:a62:d0c5:: with SMTP id p188-v6mr10164406pfg.101.1528547894055; Sat, 09 Jun 2018 05:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528547894; cv=none; d=google.com; s=arc-20160816; b=pB1yMHH30y6q41+cdxYQXuEffkRhnGYY3E3arWkyXIR7Dt8NNDFIo142ZujxcEo9W5 rb5U2B+Uj0YQnIQjTJ8uD4XZLK19aJNcEULjxItsSttR10PIGQPzJu10uhzX8qNvSAt3 j5lndpbq57l1Y+gMWI0sm7K0g+6PDavSnElENXIw2VGrbBWZQ++gVNXjjviBFVh2XyO1 1i4K1w3d4gisiLsIQn6V6gmD++2zcseKlE8ng8L7sccibydFKyRyE7sOXF4M3kGZ1ztd szIptsJS1NROFG+Vb2yE2V4+9ccLgCMA1WqSOQjAMlO9PD0mWQ2nMQ/cL3CKjJNdYxJv OONA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=lRfQ7fIEPfr2sLnMmoppNJZNzi9lzi/nped66Q6OpiU=; b=YJpZdGpMK1meFwIlx+n2Y9Fnxaqj04YMfDXDrzufPTW/Vy45l2e04FVBleu9gJ1iZT IhEtvrNzwfYTuSsRJA95Qz+a4O8yjNGPJ1Nj0NMxzGwI1hqdYyBuSlanAsB5V+RZWo8L aO47vF1s3A/fdhFYkLl8UskMfOYM4bvn2E/3SPt8JK85XB6SBg7dJzMYsnr9YuLHWYhb p8YQT9BodMeLOcIyetiiYSLwzGcDiz2PV0DWvgawWX609PwV38xCot4+ctkdRv0CzEKt p+qJVErK71FyqO607mPVoJLB6ZMC7o25y+taAy7dxOkqug9QgRKp5QY4bFOk4QMcGOCz 5LUQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 89-v6si30565249plf.224.2018.06.09.05.37.59; Sat, 09 Jun 2018 05:38:14 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753524AbeFIMgQ (ORCPT + 99 others); Sat, 9 Jun 2018 08:36:16 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38402 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753388AbeFIMgN (ORCPT ); Sat, 9 Jun 2018 08:36:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04C63818BAF3; Sat, 9 Jun 2018 12:36:13 +0000 (UTC) Received: from localhost (ovpn-12-40.pek2.redhat.com [10.72.12.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id D96A41116709; Sat, 9 Jun 2018 12:36:01 +0000 (UTC) From: Ming Lei To: 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 , Randy Dunlap , Ming Lei Subject: [PATCH V6 30/30] block: document usage of bio iterator helpers Date: Sat, 9 Jun 2018 20:30:14 +0800 Message-Id: <20180609123014.8861-31-ming.lei@redhat.com> In-Reply-To: <20180609123014.8861-1-ming.lei@redhat.com> References: <20180609123014.8861-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Sat, 09 Jun 2018 12:36:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Sat, 09 Jun 2018 12:36:13 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Documentation/block/biovecs.txt b/Documentation/block/biovecs.txt index 25689584e6e0..3ab72566141f 100644 --- a/Documentation/block/biovecs.txt +++ b/Documentation/block/biovecs.txt @@ -117,3 +117,33 @@ 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, whose names have the suffix "_all", can only be +used on non-BIO_CLONED bio, and usually they are used by filesystem code, +and driver shouldn't use them because bio may have been split before they +got to the driver: + + bio_for_each_chunk_segment_all() + bio_for_each_chunk_all() + bio_pages_all() + bio_first_bvec_all() + bio_first_page_all() + bio_last_bvec_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 +iteration: + + bio_for_each_segment() + bio_for_each_segment_all() + +* The following helpers iterate bio chunk by chunk, and each chunk may +include multiple physically contiguous pages, and the local variable of +'struct bio_vec' or the reference records multi page io vector during the +iteration: + + bio_for_each_chunk() + bio_for_each_chunk_all() -- 2.9.5