From patchwork Tue Dec 27 15:55:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9489385 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 1DD2B62AB6 for ; Tue, 27 Dec 2016 16:00:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DC79200E7 for ; Tue, 27 Dec 2016 16:00:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02A86201BC; 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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 872FB223B2 for ; Tue, 27 Dec 2016 16:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755273AbcL0QAd (ORCPT ); Tue, 27 Dec 2016 11:00:33 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35324 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752673AbcL0P7v (ORCPT ); Tue, 27 Dec 2016 10:59:51 -0500 Received: by mail-pg0-f66.google.com with SMTP id i5so12785737pgh.2; Tue, 27 Dec 2016 07:59:21 -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=JGsJhfVzWXsvuiVG7UP36sTTnQIpagEGr1kQPkcUOxI=; b=rzZLph05EUUJLhR79Jy8CTAbax4EXL498TxChYHLtchopWZ6/Fpv/VsbrIoJvLDKHo GMkn/R+/UQl70Z3OKz7qwYgyqrsumXkkfhfljwld38ZnYwgRuiEhBEQxrQZZEdWL7RrG C+Zhz4+M3LK1n7SZ79YLNT2Kr3ke+OeYJQ2EbYD7/0fAnkkw8puG11AMadJKzF2gIKHX 83wUDl6fQKt0J/rS1wKXV8z72EWX7h8zyCyJIP5T6G7W2ak6uJDY/gIdmTG842YfHBNo 6wZGo7nyBW/i+npGd+Di3LUAj0Ukypg37sDE8M8wmv6nXHUu10Q+Am/X/Yg4sBAkJ7RT 9M9Q== 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=JGsJhfVzWXsvuiVG7UP36sTTnQIpagEGr1kQPkcUOxI=; b=L+1zq47yeiWcyA16U6u+G0sw81gU+o5RonK+IxxUV9T2UvvsoWK4GE4e/joWsvgbIb v78pqj20ITy07a1ZRnIBfH+A1eC+g/VJEntMzlRl20MrDMY14zAohjricFoZ6l6g8OGx JlPV9aQmReUoi5uNu2RPWO6LrOZSTNEENn1jXJlHLYf0Sv2EQLJvhy0hvcdFiPjF+Jt4 r/4kAzBz302EN+OfW3lAccfH6pQpSqkFf7lYA7L8wGlS/xFlJEBqoLrqkra+b8uXWtwo CgOF/Ib7G1C5eDak3vpYc6MFAk+GX2GJf9IpHR7WSC8CiBGB7DohF4r7VIggeCILfWyh Y6sA== X-Gm-Message-State: AIkVDXL1G2wA2MI8MZgEq9l3FsANWjtrtzA1ZfG/JnRCKVPaHyAVlEXrRCp9Y9xczZVIQg== X-Received: by 10.99.217.81 with SMTP id e17mr59459106pgj.127.1482854361383; Tue, 27 Dec 2016 07:59:21 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id z29sm64658983pgc.11.2016.12.27.07.59.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 07:59:20 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Jens Axboe , Kent Overstreet , Shaohua Li , Mike Christie , Guoqing Jiang , Hannes Reinecke , linux-bcache@vger.kernel.org (open list:BCACHE (BLOCK LAYER CACHE)), linux-raid@vger.kernel.org (open list:SOFTWARE RAID (Multiple Disks) SUPPORT) Subject: [PATCH v1 08/54] block: comment on bio_alloc_pages() Date: Tue, 27 Dec 2016 23:55:57 +0800 Message-Id: <1482854250-13481-9-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 adds comment on usage of bio_alloc_pages(), also comments on one special case of bch_data_verify(). Signed-off-by: Ming Lei Acked-by: Coly Li Acked-by: Coly Li --- block/bio.c | 4 +++- drivers/md/bcache/debug.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/block/bio.c b/block/bio.c index 2b375020fc49..d4a1e0b63ea0 100644 --- a/block/bio.c +++ b/block/bio.c @@ -961,7 +961,9 @@ EXPORT_SYMBOL(bio_advance); * @bio: bio to allocate pages for * @gfp_mask: flags for allocation * - * Allocates pages up to @bio->bi_vcnt. + * Allocates pages up to @bio->bi_vcnt, and this function should only + * be called on a new initialized bio, which means all pages aren't added + * to the bio via bio_add_page() yet. * * Returns 0 on success, -ENOMEM on failure. On failure, any allocated pages are * freed. diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 06f55056aaae..48d03e8b3385 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -110,6 +110,12 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) struct bio_vec bv, cbv; struct bvec_iter iter, citer = { 0 }; + /* + * Once multipage bvec is supported, the bio_clone() + * has to make sure page count in this bio can be held + * in the new cloned bio because each single page need + * to assign to each bvec of the new bio. + */ check = bio_clone(bio, GFP_NOIO); if (!check) return;