From patchwork Sat Oct 29 08:08:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9403175 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 6BA90606DC for ; Sat, 29 Oct 2016 08:14:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55FA12A597 for ; Sat, 29 Oct 2016 08:14:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A8202A5EC; Sat, 29 Oct 2016 08:14:14 +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 F3A7E2A5D7 for ; Sat, 29 Oct 2016 08:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942769AbcJ2IOH (ORCPT ); Sat, 29 Oct 2016 04:14:07 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34531 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941855AbcJ2INh (ORCPT ); Sat, 29 Oct 2016 04:13:37 -0400 Received: by mail-pf0-f195.google.com with SMTP id u84so3377886pfj.1; Sat, 29 Oct 2016 01:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9u3oPzrFURvJv6jxXdGpBFDaLv0a7fZVYDBHoPc3raI=; b=UyZb9sfoUTTQ60IRNILzOGkARl8xnQRV81ja0P19GAIAh19/WVxkstOSZyGlZscIAu uekg+B0HUmyFaesr48Cyq8xwpfQenYFEsrlY4+fPWTR+Op+4l1LxI1hVAhfIWNNuKXhC pPwUsQGkQOYAwbfIDxO9Z2+aVV7/r6mY0/zqQMRujuzecredqvgtWHQdh+2VZMbbH7CA oc1xQ1WzZCAM06Wj9usmOUhSPaB7/SrMK1YPWp19l8zkjEFaP7MpWZuj5aXMxo2H4ysX 5ZQfohWQ+kwjJ/pbvGjWhQ1klCJg1DtZaUf0xyHQYY+F9VpTrOcgBTre51Inm4l9BaAw ommw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9u3oPzrFURvJv6jxXdGpBFDaLv0a7fZVYDBHoPc3raI=; b=XmWQhlxfq14XmUfwzJ5necgGzlROu5bQnpp4K9NQGhQz/u6T0N1YcAavLHkY4A551h dQ33DkoS//8qA1KYei5lGy7xG3IOjdb36ZcXSbP6dBrchRAzpP+SMkhe1ZRsGN1LreqS aft02YWPlaqkJZZiVIuXOvFH0INJ1ScPulrhs9mpthsjTrROdK4BFwAhER+/iB9rCZ9g JRgLu1wc+t0RebzhHW8TcFbfqN+f4ZZF3WssT3UmN9Y/BnY1MT3a3LYpWS4RnXqVA4RN caS9paX4FStgl5am7UvAD4/np3wTEbJYcRuBM9hgeB6YCGKY1EGiNWgfn9sZiJERr98w yOiQ== X-Gm-Message-State: ABUngvcngSc2PE3DeO8TrqTa0KpbRhqXvs7laDBV8VYrEfx07mtY6jRjW12qOPBEfogwYw== X-Received: by 10.99.168.10 with SMTP id o10mr26475620pgf.152.1477728816840; Sat, 29 Oct 2016 01:13:36 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id v84sm23463918pfd.91.2016.10.29.01.13.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:13:36 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , 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 22/60] block: comment on bio_alloc_pages() Date: Sat, 29 Oct 2016 16:08:21 +0800 Message-Id: <1477728600-12938-23-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-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 --- 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 db85c5753a76..a49d1d89a85c 100644 --- a/block/bio.c +++ b/block/bio.c @@ -907,7 +907,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 no page isn'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 430f3050663c..71a9f05918eb 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;