From patchwork Thu Nov 15 08:53:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10683883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5EA214BA for ; Thu, 15 Nov 2018 08:57:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C45ED299C2 for ; Thu, 15 Nov 2018 08:57:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7B8C2B334; Thu, 15 Nov 2018 08:57:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CA28299C2 for ; Thu, 15 Nov 2018 08:57:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BB466B028B; Thu, 15 Nov 2018 03:57:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 642466B028C; Thu, 15 Nov 2018 03:57:48 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E3E96B028D; Thu, 15 Nov 2018 03:57:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 1EB9B6B028B for ; Thu, 15 Nov 2018 03:57:48 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id a199so43318044qkb.23 for ; Thu, 15 Nov 2018 00:57:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=1VthWFeyi5rIl88r9mrERDwdoFL6E3EkYoZDARxIQUk=; b=GcwPq3UfYCAPB5KvFph8vxkHg/MEDKitx+en7Q9zlgdlxNOndUwn2g395i9F6imgZr 8y4XptTB/jo+86KwwEYQnoqEVe570XoptHDQKo243qll7z5s4JKu6ybC4HP5R79/EwZM 0yLsQ6HGFyeLZUndlL1iWxquqkKvBaTxRlxh+YxQIy01GZ22G1u1DLpjhzjGsYIo/nC/ AZbzYPqE5txdy6hvF1mHdIdgsYa1uR98BuwatuCPMVK4rtNaaBXUmxTXG70oosZDIE2n Upbvm4/Cxgze3tOWLyPL+38dN1CP0p3rrRnVngrpPSml+ImxEYEH4F2GVr6/fUF3qGV3 j9EA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AGRZ1gK3BFKXNKwU3PrXhbpCVkHohus+Edjbi5f9c8TaPPg5owmlTzO+ 6gQJY+uUVu2XQscUdR9P5aTOVDQuIB49Ghu8dw88g/LAWuHpqaQComhmdIVapzAHp8Xna3bkBqn quU1ZnJ/EC8sMLulYRcSAQj4LwJuRRBXJqiSyT5Fnu0XHgHG5Hp/eNBSV/ibD+sLqGA== X-Received: by 2002:ad4:510f:: with SMTP id g15mr5447507qvp.46.1542272267886; Thu, 15 Nov 2018 00:57:47 -0800 (PST) X-Google-Smtp-Source: AJdET5eFp26GADgAlYrqWtsvIlSysrKYJG7Lt91xSsMZtTdY7kqfbjaPNw/v89E5wSzu08Qlq/wd X-Received: by 2002:ad4:510f:: with SMTP id g15mr5447496qvp.46.1542272267402; Thu, 15 Nov 2018 00:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542272267; cv=none; d=google.com; s=arc-20160816; b=VmpEUhZBud3EQvdyfAu+4bc6MZSlvonzeT8FubRo3l/ddkuEhTAjiL5k5dpgzFOEkf NKrttFVy/iDwYkmIc2pK9rGMCdedynLVMABPze3u8rVbUfDu1Yvrxy1wDrlV11zrByby NaVrIdJvun7GgSHS+ILQINtyblag8+j6RJWoGZ/9V5MrzaQQdb8C/PuWb1NoBmvpmGFS dz7djHyfLjXzsIoJDotXR+LRXms1ZGh9GX+CbY/F+0/FkL4xKWmL01r0GqbOhOhnTq1r /Kh4i5z/gls/GRecMm2A4yyJMkMJfDxp2UsACgV74GvpIPpMlBqcWZz4CKSDUZTIEnn2 V3mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=1VthWFeyi5rIl88r9mrERDwdoFL6E3EkYoZDARxIQUk=; b=q+tofPGMjnCcI2P8HMiTjJprG8C0MW1UGHAEHHPwMtyyxPKwUhpXc65uAho+SsUzXp dTPTr8T0Av7OfyJOUncPbyE8CbZegWXjVUS5L/Rya8PCCIruTI/3h57avxKZFaAM5J3j 1Ujc1reQ+Pz97c5NhC2Csh43/M9BDULsRr210ltfmzrplB8KMjJAL75Hm4TRFBo3U/fU 6XQhN6M1anV0sIUsC67ncNNbIjS8SA1rN+Xi1rx3t6Mre4DpukttFWjNKyfmvk0XwPrC bcSVntYOdZ33sBLmrdx5sCZRfa4RUYHquRKBpTpCqro9kRyWvuDWKEZ42m6vupgbpAC5 E6Sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id i20si1404077qkh.98.2018.11.15.00.57.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 00:57:47 -0800 (PST) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=ming.lei@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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()