Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7769296imu; Thu, 15 Nov 2018 00:58:57 -0800 (PST) X-Google-Smtp-Source: AJdET5eziIegJpEHXzPjN5c5RAxo5yJTFCGHPDDrq3+2JXAC9fjMtlaonp2uSfMst6fl3gxCWyDm X-Received: by 2002:a63:e915:: with SMTP id i21mr4892201pgh.409.1542272337851; Thu, 15 Nov 2018 00:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542272337; cv=none; d=google.com; s=arc-20160816; b=ApAx2hRDO11doYQCMCcEwt8GFwEuJh4wuH9QgbPlg4yIXdZWMn+PnqsL6yt7/pwdVp z0D60qcMV3tydW8Vxd54Hf6du0JxjOcMKiyFidoF8iGjOjAVwHOW3uzty765hEXVwVZY qH3yPA7EEpdPdnGeFKZTtgVEIJvb1HLwxEcjtAWD1d77cWOslZABuQ1AQVGISJHfSn0N auRJPQkzrDWPxirSDziWTFYjfHhHXGUHC2Ht5gq7JaGoTdOSCmcLxHY7unBIxNCTxLGJ 0qdUvH1rd2/Al8Xxk0HNeEdKS+XsS0hlycpviGGMx7D7LADq4MY3LJupYvznV0WB2Mb0 Gmzg== 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; bh=1VthWFeyi5rIl88r9mrERDwdoFL6E3EkYoZDARxIQUk=; b=Y0kulidfO2XjaxoJZ4BtEyCoMbprOB0xZVj7ougR19wfmJl9oe27V8iwC5W0SzEyGq FJ4RZqNYvVSJFU+Rvy+NYR+nqErGJwaaksPkDKQbuaIVtUc6y+FlT7bl/33WDyq2m7CQ 8GdRC0DQljU6hNNROU/0GHRxwmX21sO7XzSuc+QkO92tYh5WXx5fpF57YvlGKPkyn8Mh 3HjgcTBWT1Uf1xJ4ePnWrCU+f0vbPVntfqpp2NsS0G77zBepfDwp31CP7tDo1FqDIqtT R7bXx0CwFnG6UR/F4WUDlbgLe9ujblIlV95ulv3P0fBk8SFfsZ3NkFNAfVmC7QHQe1L4 rbxg== 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 j14si15172939pgg.44.2018.11.15.00.58.43; Thu, 15 Nov 2018 00:58:57 -0800 (PST) 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 S2388221AbeKOTEl (ORCPT + 99 others); Thu, 15 Nov 2018 14:04:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57862 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728519AbeKOTEk (ORCPT ); Thu, 15 Nov 2018 14:04:40 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41C9030B9DF6; Thu, 15 Nov 2018 08:57:46 +0000 (UTC) Received: from localhost (ovpn-8-23.pek2.redhat.com [10.72.8.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACE015D75F; Thu, 15 Nov 2018 08:57:33 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ming Lei , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, linux-erofs@lists.ozlabs.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: [PATCH V10 16/19] block: document usage of bio iterator helpers Date: Thu, 15 Nov 2018 16:53:03 +0800 Message-Id: <20181115085306.9910-17-ming.lei@redhat.com> In-Reply-To: <20181115085306.9910-1-ming.lei@redhat.com> References: <20181115085306.9910-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 15 Nov 2018 08:57:46 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now multi-page bvec is supported, some helpers may return page by page, meantime some may return segment by segment, this patch documents the usage. Cc: Dave Chinner Cc: Kent Overstreet Cc: Mike Snitzer Cc: dm-devel@redhat.com Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: Shaohua Li Cc: linux-raid@vger.kernel.org Cc: linux-erofs@lists.ozlabs.org Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Cc: Darrick J. Wong Cc: linux-xfs@vger.kernel.org Cc: Gao Xiang Cc: Christoph Hellwig Cc: Theodore Ts'o Cc: linux-ext4@vger.kernel.org Cc: Coly Li Cc: linux-bcache@vger.kernel.org Cc: Boaz Harrosh Cc: Bob Peterson Cc: cluster-devel@redhat.com Signed-off-by: Ming Lei --- Documentation/block/biovecs.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/block/biovecs.txt b/Documentation/block/biovecs.txt index 25689584e6e0..bfafb70d0d9e 100644 --- a/Documentation/block/biovecs.txt +++ b/Documentation/block/biovecs.txt @@ -117,3 +117,29 @@ 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 of "_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_segment_all() + bio_first_bvec_all() + bio_first_page_all() + bio_last_bvec_all() + +* The following helpers iterate over single-page 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 multi-page 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