From patchwork Tue Dec 27 15:56:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9489383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D5F9C62AB0 for ; Tue, 27 Dec 2016 16:00:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8837200E7 for ; Tue, 27 Dec 2016 16:00:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD6C82094F; Tue, 27 Dec 2016 16:00:36 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66BC2201BC for ; Tue, 27 Dec 2016 16:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754960AbcL0QA3 (ORCPT ); Tue, 27 Dec 2016 11:00:29 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34192 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753964AbcL0P7x (ORCPT ); Tue, 27 Dec 2016 10:59:53 -0500 Received: by mail-pg0-f65.google.com with SMTP id b1so12790707pgc.1; Tue, 27 Dec 2016 07:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HqpA9+t7Vo7rDvyDUrJTKlHDKJfeC6kmEmXEOdYr1AY=; b=lc4ysJoSJoMUT6/Zti4/qzmxubZ566anzxFhPmjFJ6W3kI79s+7woRjHhJBXAEc0Wc 2UFiG64gEXyy1tu9RQiT/yP/w9f9h2QDXpYz87N0L1AkDOHKtjlgnj/CKdiYcQBoJexz uVzL+PN7vokJZa4/RmCyr+DeJz6iNQECq5XT15GkaqlGPkYhjAXpqamTQn7bf6cn6G4p nEN2Sata/JZRRjh9bbrVZ2STVDP4xx9CdUd9drg3ThKtesvlWhbiPvLB40bOSHTuYhf7 aRWS5irJNWjsc+J98r+CLONB+VoIAY5FbKdcLCja8T57kKZbQa2VuVVjNroANyrNcrKd k/Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HqpA9+t7Vo7rDvyDUrJTKlHDKJfeC6kmEmXEOdYr1AY=; b=lveZstNdFNwRllfyt0JgSSHVBHSM6eUb9kkm8/zZCE95FLTiSgCvIjlVkYLxJP7AVt FL9Xb9aMk/ZZwUrscH2oKnSolp6P7JDpEdjwUX5PuNeR+U9Mjb34itm7fgD6TiROizo4 Jt/7GLiC8dCeYwIxVZGzfLhr1k3Aepk1qAIw5+a2kpzXvj/FkqJ+V1bXcnY4BGJOZyRo D81bfOxu1gobzRMzxrSIcWLe/7XS0FBPqrDJQWa/MB3ea6zm5+8Uv6V9rckNqwZ4usBd VgmqA5C+OW/5ojCErVL9LXlAVt+PONY+PIKQgUMZ3QfQYv3XcC/YZgNm5w1r3iGWbUBo E1ng== X-Gm-Message-State: AIkVDXLaWeO/QTiVvKIfexV6xUFAYn2NJSv8u/paQYgXtgCXWAyvjWkXnxrtZ/DApxK+sQ== X-Received: by 10.84.131.65 with SMTP id 59mr66930972pld.79.1482854392311; Tue, 27 Dec 2016 07:59:52 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id t25sm91372226pgo.9.2016.12.27.07.59.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 07:59:49 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Mike Christie , Hannes Reinecke , Kent Overstreet , Chaitanya Kulkarni Subject: [PATCH v1 13/54] block: comments on bio_for_each_segment[_all] Date: Tue, 27 Dec 2016 23:56:02 +0800 Message-Id: <1482854250-13481-14-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482854250-13481-1-git-send-email-tom.leiming@gmail.com> References: <1482854250-13481-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch clarifies the fact that even though both bio_for_each_segment() and bio_for_each_segment_all() are named as _segment/_segment_all, they still returns one page one time, instead of real segment(multipage bvec). With comming multipage bvec, both the two helpers are capable of returning real segment(multipage bvec), but the callers(users) of the two helpers may not be capable of handling of the multipage bvec or real segment, so we still keep the interfaces of the helpers not changed. And new helpers for returning multipage bvec should be introduced. Signed-off-by: Ming Lei --- include/linux/bio.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 7cf8a6c70a3f..714fbf495af7 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -156,7 +156,10 @@ static inline void *bio_data(struct bio *bio) /* * drivers should _never_ use the all version - the bio may have been split - * before it got to the driver and the driver won't own all of it + * before it got to the driver and the driver won't own all of it. + * + * Even though the helper is named as _segment_all, it still returns + * page one by one instead of real segment. */ #define bio_for_each_segment_all(bvl, bio, i) \ for (i = 0, bvl = (bio)->bi_io_vec; i < (bio)->bi_vcnt; i++, bvl++) @@ -178,6 +181,10 @@ static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter, ((bvl = bio_iter_iovec((bio), (iter))), 1); \ bio_advance_iter((bio), &(iter), (bvl).bv_len)) +/* + * Even though the helper is named as _segment, it still returns + * page one by one instead of real segment. + */ #define bio_for_each_segment(bvl, bio, iter) \ __bio_for_each_segment(bvl, bio, iter, (bio)->bi_iter)