Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3000383imm; Thu, 24 May 2018 20:53:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp3BwzRxftM+XQnKwH0WcNwskhIjQyv8/bp5mXAfB16dp+moIl6gv3O56okReUe0cFrFPWO X-Received: by 2002:a17:902:9304:: with SMTP id bc4-v6mr812279plb.189.1527220409527; Thu, 24 May 2018 20:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220409; cv=none; d=google.com; s=arc-20160816; b=sVIklY6kFRBXjfGACDvnU8mZ6+jZI7EC9R/vw7ojDATeAn9CvQi/ZQv11Lf+Tw5XbA G2u/mVzRrWcK+AoQ+h2c8IUACNfHyj1ZlpBRHjVpQD4hODvBRh13BECJNkYZOUYcGEdq I5vsrs8Zmmyli0l1GFPoG1YDRKzcc0OM19NJNtkdbUFGlD8Yck3STK9WHknEPUzFB5Ai 47W0d2nf0Y7ZMf1KclPTeksZu96DmXyn+C8hR9BGqOHTU+0HblMOnrFe3/qJtFXpGZCx kNL+EqJkFdPyo0Tl+7bLJ33mqDdS3b+q+9gzhi4sC6iYbX212B9SdZtcQcccM1f7Ux3l VZNQ== 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=Q8hZ/a/GKODRUZtZw2nxIkPAEeJoO2hDsp2SzrPAukE=; b=c0I/QEIqh9HfKxRqyJYjluURzSVLqrkG+dh4Ouoz9V1r5PkJjnkgYMsNbXTrSs5Rhg NWqsaB5ipmXMSRBCz5BHABJh7BAl8WCHdEFaJ4sQKhVJRpTFyDWTN1UGAQl9+jBfXdmi GDBL1FQsHX0vJNx5j/b+ZaKuETmk4CtCZWci7/RxTqqiwAvTs/knAbGugigbND93RRsF t2ymigO8t8TJYeqhgkTlJsqIpIeWEXa6ZrjB9lAwqeTfqYCBo3IxB+i4pTZyFQO3cZez amt24FzvsRU7XVucwsFIzxKa++8KYcAVzzo1xkYn60KaLtro9tpBquZ7T7aEGnCFVpc2 NwDw== 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 a33-v6si22109041pli.275.2018.05.24.20.53.14; Thu, 24 May 2018 20:53:29 -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 S935954AbeEYDwy (ORCPT + 99 others); Thu, 24 May 2018 23:52:54 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933328AbeEYDwx (ORCPT ); Thu, 24 May 2018 23:52:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F6BEC12C4; Fri, 25 May 2018 03:52:52 +0000 (UTC) Received: from localhost (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9EA72166BB2; Fri, 25 May 2018 03:52:44 +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 , Ming Lei Subject: [RESEND PATCH V5 33/33] block: document usage of bio iterator helpers Date: Fri, 25 May 2018 11:46:21 +0800 Message-Id: <20180525034621.31147-34-ming.lei@redhat.com> In-Reply-To: <20180525034621.31147-1-ming.lei@redhat.com> References: <20180525034621.31147-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 25 May 2018 03:52:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 25 May 2018 03:52:52 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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 | 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 +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_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: + + 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: + + bio_for_each_segment() + bio_for_each_segment_all() -- 2.9.5