Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6398390imm; Wed, 27 Jun 2018 07:08:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJe4b38A4lXBalWP26fAsIo28dHpC5KK751DdERHZ5ruFBPpmInW18a6xwpT46Trp6WXvwh X-Received: by 2002:a65:4e86:: with SMTP id b6-v6mr5430613pgs.322.1530108503683; Wed, 27 Jun 2018 07:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530108503; cv=none; d=google.com; s=arc-20160816; b=KrjlcufA5S1izfAdqzNwGkO2h+5/Oac3KSN2qy76+Ja8jt5wbX0agqSbkROAyOk8H4 j1CABxfA8pBsFxzmTAkT1MivgewrF6+SW8/vqk53TNRgxQDd4JiddasXlYqdpAp6hFQK 0bmkLK2F8jBs1N/GvXnWzP8AGztjJKmfKBnFUCZwLxOA/i0hNo1IQAVv1afWSTkEzwRK vh5vvD0/itN4gyWMqUWU0j0ZnjTeL67MZjtORhrvCL0nBVw8c7oSloTRLbViS/wv+wFY QuubPnYZ676XdYSsgtvU3YoMx2G3RMK5H9Vw1rz67WHTpt6QCEWOnp0yZpupHjTQdP2b /1Cw== 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=AtcimxthIaVCGJL56bpnJ5osFyv2NY61aRfqkoMfQ9c=; b=QCwGV+p0x04mJwoyXxDNf+O+N6bY6B9KdRwDb4W89LT48iLrosl4ngYavhTxmvgqeH z5Qcq3iZ/gbYu4n7jxYaYVxX52U9sm71VOyWSXILwDy/mqpT8AOqQPNmOCXuwrkLXz0X dTvLKjk81bizKdhhbayOLonH4MjZUrsd3P6tVMuTA9dmivd9uCdSzUMxGJlwkeIQv2Uy FOJwPk8SRAXx1m4oE/dZqAXTfff95UxtYHaLpU+SyKYINGVcWaZJgwWdbne/LW7t2xVG 9aiyhF41gYbslMfirPo7QW2jBzdN/3AxswCCRJBIXe1xfqBBF/fFS6oZxJHJpAjNJfQM WhPg== 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 y65-v6si3986880pfi.195.2018.06.27.07.08.08; Wed, 27 Jun 2018 07:08:23 -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 S965335AbeF0Mux (ORCPT + 99 others); Wed, 27 Jun 2018 08:50:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55694 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752257AbeF0Muv (ORCPT ); Wed, 27 Jun 2018 08:50:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9ACD4BF578; Wed, 27 Jun 2018 12:50:50 +0000 (UTC) Received: from localhost (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 857AA1C5B9; Wed, 27 Jun 2018 12:50:39 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Kent Overstreet Cc: David Sterba , Huang Ying , Mike Snitzer , 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 V7 24/24] block: document usage of bio iterator helpers Date: Wed, 27 Jun 2018 20:45:48 +0800 Message-Id: <20180627124548.3456-25-ming.lei@redhat.com> In-Reply-To: <20180627124548.3456-1-ming.lei@redhat.com> References: <20180627124548.3456-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 27 Jun 2018 12:50:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 27 Jun 2018 12:50:50 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/block/biovecs.txt b/Documentation/block/biovecs.txt index 25689584e6e0..f63af564ae89 100644 --- a/Documentation/block/biovecs.txt +++ b/Documentation/block/biovecs.txt @@ -117,3 +117,30 @@ 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 +non-BIO_CLONED bio, and ususally they are used by filesystem code, and driver +shouldn't use them becasue bio may have been splitted before they got to the +driver: + + bio_for_each_segment_all() + bio_first_bvec_all() + bio_first_page_all() + bio_last_bvec_all() + +* The following helpers iterate over singlepage bvec, and the local +variable of 'struct bio_vec' or the reference records single page io +vector during the itearation: + + bio_for_each_segment() + bio_for_each_segment_all() + +* The following helper iterates over multipage bvec, and each bvec 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: + + bio_for_each_bvec() -- 2.9.5