From patchwork Wed Jun 27 12:45:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10491345 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 6754C60325 for ; Wed, 27 Jun 2018 12:46:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 569F028BEB for ; Wed, 27 Jun 2018 12:46:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49E8928D5F; Wed, 27 Jun 2018 12:46:18 +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 D59D228D5B for ; Wed, 27 Jun 2018 12:46:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10FCE6B0010; Wed, 27 Jun 2018 08:46:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0985E6B0266; Wed, 27 Jun 2018 08:46:17 -0400 (EDT) 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 E7C286B0269; Wed, 27 Jun 2018 08:46:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id BC27F6B0010 for ; Wed, 27 Jun 2018 08:46:16 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id x16-v6so1852182qto.20 for ; Wed, 27 Jun 2018 05:46:16 -0700 (PDT) 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=G2Ko/gF1vZrwtr408s6HZ/YuWF2BN1FJztSKsip3Prw=; b=JucfIGgFEG7bFeJad7NHCsGVgcazJJfPcacmYz/4Bwg/2Jvl8Bt9YFen/QlJgkwxG2 XpDgbjTpDcEH7ZqAKNMUuPzz5JOMVr4gCznUV8nZj+Ia9Au478IOw7eMP5A9QzquUU44 8O6WBxHqsCMGjFIpQUWLkEZAmPxDqp+UFMW453wP17xTxCqj8THi0j/nvL/Ta3tE3AWN h3CTjiTmXEAUIz+8GuIMwNdk3BhKUKTGr36MQF9+62vSucbWLZ/vD7Kof2rHut0op68Y VX17FwubOa9soNOgfR5K4yl/tN+6+W9TiwP/7+XZdfkW8Cj0bn6uP5ycN4T15X5AxhVI xtkA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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: APt69E2FmdS6wU9WcGgFQu24vJt3B2YWqulhU5lCZ8nr+CLlONsvaWMa miFE5KWa5zemn79O9OH+k/4tHGuRhHDkpBUP56EqoiJkyLUWLU4zsy6P2DiAcMukzByk5qmB4Rf HKN1Y70NnAGbjHxW6QL+/FufOfJg0Mp29GC5XDjIoXROfeiDY2RJ2dggEFpMZvjQNIg== X-Received: by 2002:ac8:1881:: with SMTP id s1-v6mr4940829qtj.401.1530103576566; Wed, 27 Jun 2018 05:46:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfXPRSI7Mff84t377EWNBrMlO+pZy8XlQtwQZGd/mwLiAuDqS2ZgCpz+E5iABWghxY+3iJ8 X-Received: by 2002:ac8:1881:: with SMTP id s1-v6mr4940801qtj.401.1530103575918; Wed, 27 Jun 2018 05:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530103575; cv=none; d=google.com; s=arc-20160816; b=aUTJ9yczZjU6pTop4OxRh4rQ0NWR7Z1wwKIafcZboUQgnb9qcQWnhRe2lIJrKmPSae 1gKjA5plib9SWbeRZ4EZ6EXayuAtXn5JaFzsFHDUQ7+SO6eVwNMD2xWgoJgmkddRHmN1 m4yDal0x5QIFmZWpbaRZinlFNavkCG0FVUchRktBXdhC5e5//qCZom9JhFzya25VWRNH tzhAorBIvZWXTAVjaoiZtsrz+XOClhtA+Up0sa8low5NYbdit2+3cLYyytMjAITt/EnG 3xRQ7c44ohfTyjkCSIQZahDXfxhRSFCx3HEfB6PkFUJ5afzFLRtAORNv46TRB+diHmBK g1zw== 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 :arc-authentication-results; bh=G2Ko/gF1vZrwtr408s6HZ/YuWF2BN1FJztSKsip3Prw=; b=izQ+67plKyA4ZGUJ9n1tMzt5JOwdfPBSREAe01xdAj1X2ISupgXGd9H/fmlvm0Liej X9LDLNm0t952RLFYoe2uT46I+IvtVvKH0svYx2n88qaD9YZUD2bJiiUbFRzyJZziv92J 6TD3RWB2iD8g1Vq6GnNqk1xWPASFnyErcsjnoj0yKt8fzzlZRjxB/nd/xKg8BXFlu9AE fJXgkgZ1DzWSfht598Ij2C6PhKhaoXLdsGJQLOMpaj9DQFX/5NMxjMxpCs0W7bUxyxrk PkFcu4s6wNCQxqTDRCpmp8gUPR957LMtxfn1VtcxyAcxnMivfEJVQE4D6gi/+7QlFHd+ gmRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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 (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id 20-v6si2363912qtr.180.2018.06.27.05.46.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 05:46:15 -0700 (PDT) Received-SPF: pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ming.lei@redhat.com designates 66.187.233.73 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-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65C6970206; Wed, 27 Jun 2018 12:46:15 +0000 (UTC) Received: from localhost (ovpn-12-44.pek2.redhat.com [10.72.12.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B8DA11166E3; Wed, 27 Jun 2018 12:46:04 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Kent Overstreet Cc: David Sterba , Huang Ying , Mike Snitzer , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , "Darrick J . Wong" , Coly Li , Filipe Manana , Randy Dunlap , stable@vger.kernel.org Subject: [PATCH V7 01/24] dm: use bio_split() when splitting out the already processed bio Date: Wed, 27 Jun 2018 20:45:25 +0800 Message-Id: <20180627124548.3456-2-ming.lei@redhat.com> In-Reply-To: <20180627124548.3456-1-ming.lei@redhat.com> References: <20180627124548.3456-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 27 Jun 2018 12:46:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 27 Jun 2018 12:46:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' 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 From: Mike Snitzer Use of bio_clone_bioset() is inefficient if there is no need to clone the original bio's bio_vec array. Best to use the bio_clone_fast() variant. Also, just using bio_advance() is only part of what is needed to properly setup the clone -- it doesn't account for the various bio_integrity() related work that also needs to be performed (see bio_split). Address both of these issues by switching from bio_clone_bioset() to bio_split(). Fixes: 18a25da8 ("dm: ensure bio submission follows a depth-first tree walk") Cc: stable@vger.kernel.org Reported-by: Christoph Hellwig Reviewed-by: NeilBrown Reviewed-by: Ming Lei Signed-off-by: Mike Snitzer --- drivers/md/dm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index e65429a29c06..a3b103e8e3ce 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1606,10 +1606,9 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, * the usage of io->orig_bio in dm_remap_zone_report() * won't be affected by this reassignment. */ - struct bio *b = bio_clone_bioset(bio, GFP_NOIO, - &md->queue->bio_split); + struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, + GFP_NOIO, &md->queue->bio_split); ci.io->orig_bio = b; - bio_advance(bio, (bio_sectors(bio) - ci.sector_count) << 9); bio_chain(b, bio); ret = generic_make_request(bio); break;