From patchwork Fri May 25 03:46:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10426083 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 69C17602D6 for ; Fri, 25 May 2018 03:49:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58AC0294F9 for ; Fri, 25 May 2018 03:49:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48C95295A4; Fri, 25 May 2018 03:49:57 +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 C38712959E for ; Fri, 25 May 2018 03:49:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD45B6B02AA; Thu, 24 May 2018 23:49:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D5DFD6B02AC; Thu, 24 May 2018 23:49:55 -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 BFF1C6B02AD; Thu, 24 May 2018 23:49:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by kanga.kvack.org (Postfix) with ESMTP id 8FAAC6B02AA for ; Thu, 24 May 2018 23:49:55 -0400 (EDT) Received: by mail-qt0-f197.google.com with SMTP id a21-v6so2910675qtp.19 for ; Thu, 24 May 2018 20:49:55 -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=eVHo6V5RT9UQDTNNcV3lg5fKvDxDCUiow6D3Fud2myo=; b=Xpg9kuOLoBLUB5riQaHOB6LnuGKU+1AA8bC31tMkFPTUk0aBwX2LIFqym1Kjbp2p7c Moc1qltD1T1culDkBR880fj8e36FenYS2NYbcXJ3Z6gZrJ5EUpxtqBhwCoX1aSXumph4 k6OtNcnesz5QELZqmc+KTaT2fXRViCcmDRcAjgDExZXi/bqOMRKRwWCcgbbIn4KNzzMb AuQNr35nPum2PfgKaeWFt3coC+t/IbqviiIRvhfYe1KTv3TqZ9fGtyiUYmZMExxQNZxg xyocIVoSyd6HNuDN54KGyH5d/yE78Z5muEZ64AZc58Vo9RRogFvG/fPW/tUc7zaJTeZu jqfw== 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: ALKqPwe9Uhv5jbQmP3AxXO0psZ6qMIX7EnNI/aec2Q8P5CHefnOAIAAH TVeGMTS4GUYeZnYBMoR8lWDD83k7RxGwt/a3PGKd1HNJ8stk3p9YvnVmpxGSBXeTdykzWlNia+c rxd4cm5AIEIB0EUtRU+bPo0Kg4NjhLUSrDTrUMnmvS8w2pQFECK/yEAvap9Pu6B0DwA== X-Received: by 2002:ac8:a44:: with SMTP id f4-v6mr592765qti.45.1527220195390; Thu, 24 May 2018 20:49:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIoSuFHT00m5KI14GYLc542uk8STT8m/u9CKWOdRff6TRj+lxPYg43/ZwugiMjDIZqa1ZqY X-Received: by 2002:ac8:a44:: with SMTP id f4-v6mr592752qti.45.1527220194915; Thu, 24 May 2018 20:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220194; cv=none; d=google.com; s=arc-20160816; b=VR17CmUPy/BtZJcZfdhlbazAso7wL9fnqtRmWACGJv2uNZ4KfABLLk4IKZC3oxnoK0 Z0Yb8H5warwWAeiZInei5ZiVjUAqO3D4jJl/uezrv3nUh4gcsiujQ0YKKZoY3ZARNg9g ZXaU8RTA1BNYM51uxaFt6EemxZ9gxr4XF1smlyVhFioojinJIWVleVCAd9WgRUF4S9Xc nQU+l/OJC6Kd/Tckce0YAj06d66KiDxArIWg01rT9ZlSSr8l3JFzWbQrTAhoq4F8WevK dQz1helVgtc2sjquiee96LoRY84hVmVSF/HEeliXgM4lexXpzEgXm8w5m3NAs5D/uCDh TYJg== 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=eVHo6V5RT9UQDTNNcV3lg5fKvDxDCUiow6D3Fud2myo=; b=PEgs/UIXhQhIcLcgZ/Wnd2QYOJwbMgil0XSEsjvzVZIXotjMm2ovVI4WMVxO1bFUz5 yiRGy421LO0rQzOWK80I0WLryJuTIJZEBFnmwkvLGL9ec5zmP8HlvZIe7W8gwZWFvsCv Zgbcb7g0ZVPXTwk+BwDIkGYxbvOaVaS0umY28dUyg9oBk3C/Fp8JxLG/ZfpyRzaLtWj4 s8h0SNdqcKOkFKSq+IgDpBiSASmP+RYqaJe+VFtY1q/INusQTxWBxaJYHHRMA56X/Ryh +tc+cx2Z+L7sjJ93XyBYmRY5cp12CoRFUF3E2ZbLP/U9e+wAFUecraFXd4vxXi85I67U KBcA== 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 35-v6si3694436qtr.180.2018.05.24.20.49.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 20:49:54 -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 893C4401EF26; Fri, 25 May 2018 03:49:54 +0000 (UTC) Received: from localhost (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83D9E111765C; Fri, 25 May 2018 03:49:44 +0000 (UTC) From: Ming Lei To: Jens Axboe , Christoph Hellwig , Alexander Viro , Kent Overstreet Cc: David Sterba , Huang Ying , 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 , Ming Lei Subject: [RESEND PATCH V5 16/33] dm: clone bio via bio_clone_seg_bioset Date: Fri, 25 May 2018 11:46:04 +0800 Message-Id: <20180525034621.31147-17-ming.lei@redhat.com> In-Reply-To: <20180525034621.31147-1-ming.lei@redhat.com> References: <20180525034621.31147-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.5]); Fri, 25 May 2018 03:49:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 03:49:54 +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 The incoming bio will become very big after multipage bvec is enabled, so we can't clone bio page by page. This patch uses the introduced bio_clone_seg_bioset(), so the incoming bio can be cloned successfully. This way is safe because device mapping won't modify the bio vector on the cloned multipage bio. Signed-off-by: Ming Lei --- drivers/md/dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f1db181e082e..425e99e20f5c 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1581,8 +1581,8 @@ 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_clone_seg_bioset(bio, + 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);