From patchwork Sun Feb 5 06:22:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9555907 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 D4654604DA for ; Sun, 5 Feb 2017 06:23:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4BBA26E81 for ; Sun, 5 Feb 2017 06:23:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B998627165; Sun, 5 Feb 2017 06:23:09 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 732AB26E81 for ; Sun, 5 Feb 2017 06:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752039AbdBEGWz (ORCPT ); Sun, 5 Feb 2017 01:22:55 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33198 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891AbdBEGWx (ORCPT ); Sun, 5 Feb 2017 01:22:53 -0500 Received: by mail-pf0-f196.google.com with SMTP id e4so4545025pfg.0; Sat, 04 Feb 2017 22:22: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=5OCbKg4VveytZN6lL1JyP0LsaJ8gP2tF+vLkXjKOvE0=; b=NNRbLZHVIQN/FIuu9B8Lm8LLZNs8CmYgHYPz2aaSS8SCMAMxpz3qqjGH6XqcCzdJaA t1gIFIcIAGLXA2O8Mz1Nx4wCJkFgVSPxp9imCPJE9DMRGc1UeA+kpq3wlEAVSGZo9Ufy +xpmXbTYh2dXbdpKszDeoPVEd0FxSb5zp+MSV6U000c/fgAAnxP3jPRovDv3B28JZQ9f BMbAM/Yjd39pLHMHO233tzuDtf5oaMG2DnYg3ufjk3RE/h77zJIiVDfexVMCoflT4Nry o52sf4ate6RepXc9fDpebgr0Nj/28r7KAXzLI2Otzd+5zuFgI96DcbirTbw/IVPDmI5p S1cA== 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=5OCbKg4VveytZN6lL1JyP0LsaJ8gP2tF+vLkXjKOvE0=; b=EZ7YEtkd7FnRPcCeyRmDAiyAavizRLj6LvdHwXo7ipiOcMIPwmQTInYUiPzM2OxP5r /QPhOHVbNLx+aEKsfZePnW0mBb7j//FxnmVPbnSijpu+H6/snUaQFvpEMku6xsDjuD0A vsyXzRS0Oj127x3Yl8HH/TMUI9yT9NABqp8PPaEr4rdx1ukTlN8uZiDWguYN8sSBMDrI QjVNbv7H3iceRZKa+ygrnrCoa1mRABazpQSNK+CndmOZOhKIJRXkP2GuKlGguBHtBgZP 48ylzyfbZCikpQ6xWLB/vK+HWoUOzxhNXIlF6UETic6XvaBQA2Iy6QqM54lmqhrBK/6c 15mA== X-Gm-Message-State: AIkVDXJPV7vtnv8A5cAV6QCjVDDXkw2wtnFzXJrgPtWujX+Dl83kP+19hUZb61rdvDjrFg== X-Received: by 10.84.169.36 with SMTP id g33mr8361458plb.36.1486275762298; Sat, 04 Feb 2017 22:22:42 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id c11sm79067760pfk.14.2017.02.04.22.22.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Feb 2017 22:22:41 -0800 (PST) From: Ming Lei To: Shaohua Li , Jens Axboe , linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig , NeilBrown Cc: Ming Lei Subject: [PATCH 4/4] md: fast clone bio in bio_clone_mddev() Date: Sun, 5 Feb 2017 14:22:13 +0800 Message-Id: <1486275733-7268-5-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486275733-7268-1-git-send-email-tom.leiming@gmail.com> References: <1486275733-7268-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 Firstly bio_clone_mddev() is used in raid normal I/O and isn't in resync I/O path. Secondly all the direct access to bvec table in raid happens on resync I/O except for write behind of raid1, in which we still use bio_clone() for allocating new bvec table. So this patch replaces bio_clone() with bio_clone_fast() in bio_clone_mddev(). Signed-off-by: Ming Lei --- drivers/md/md.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 704be11355a9..7d176f025add 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -193,10 +193,14 @@ EXPORT_SYMBOL_GPL(bio_alloc_mddev); struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, struct mddev *mddev) { + struct bio_set *bs; + if (!mddev || !mddev->bio_set) - return bio_clone(bio, gfp_mask); + bs = fs_bio_set; + else + bs = mddev->bio_set; - return bio_clone_bioset(bio, gfp_mask, mddev->bio_set); + return bio_clone_fast(bio, gfp_mask, bs); } EXPORT_SYMBOL_GPL(bio_clone_mddev);