From patchwork Tue Dec 27 15:56:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9489387 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 0760862AAD for ; Tue, 27 Dec 2016 16:00:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE187200E7 for ; Tue, 27 Dec 2016 16:00:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2FCC201BC; Tue, 27 Dec 2016 16:00:37 +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 A7AEA25F31 for ; Tue, 27 Dec 2016 16:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753964AbcL0QAf (ORCPT ); Tue, 27 Dec 2016 11:00:35 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35217 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753065AbcL0P7v (ORCPT ); Tue, 27 Dec 2016 10:59:51 -0500 Received: by mail-pf0-f196.google.com with SMTP id i88so18311109pfk.2; Tue, 27 Dec 2016 07:59:44 -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=pOTiXqHjWJ5ru0yHAk6Sg4Y2TB9MY7gEIblDvkcn9Ew=; b=Aipt7p0ilTlRcoQbsI5l/jlb3gZcPdPcWJrSF+maGFhsyk73oFKSjb7Fmq9h5JqJ8d bwmtL342aIme3FbRdvdAuXeSupzOVaj+wdypEc4IOx0g023WThkzzfZP+T+w4W3U/LV3 10aYbJZoOnExemPDZ6PKS6DbrMH+KDziLW1mo1A8SIXNq2w2OuV5flGJsaTpsSCPUIxS n/1jtwo05dVh2CofHs0MP1yOadGKQdWnKBIrQCq5bt60WkMJkwfwCOxGgTuR4clGS1jR YzNiXUWsycPsDEsd/a+7Cgs9uixPMqv7ee3mqI0Ld8HnRyDh2jv38J5uwTo6inYnSVF3 vA/w== 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=pOTiXqHjWJ5ru0yHAk6Sg4Y2TB9MY7gEIblDvkcn9Ew=; b=YiPM6cD4nmHGkI8Hy/a4d3uk7ZX5d8lpF9LlyPUGCTvzGBaqkp2+IR3HgKj0l03IKL /7YnFji8+wM1Ct2VCIFHGcdWfJzv5WXBIfgkrvQWf8W6q6nyTOmK5cPSWAGDBYeSuAGz 1z1lcChYugpU34f8XYSIVcppZjcx3ZmKP1VVJMiRfI7HLNgtlG0KOes7VxseYA6/4+RF bwwl+AOLlkzdl6mvFGwe4eTqg0KSX4qVkuaoCxnj4IZObeFRBYzaWxFsf9OAob6R9sEU SEteG4C2HA8+xzJuqHJE6RNzv9dfxNVV9Ttpr5VkNkMlNVaHdmQCxcP/K/z+wCBo5qBX zRRw== X-Gm-Message-State: AIkVDXK8wQsiF4iqY6YktJIGF/+ljfQkG2PBsz4muf/21rw6AK1MxVdkiff1NWE8QR5n1w== X-Received: by 10.98.252.75 with SMTP id e72mr30196229pfh.6.1482854383713; Tue, 27 Dec 2016 07:59:43 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id p127sm89081776pfg.24.2016.12.27.07.59.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 07:59:42 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com (maintainer:DEVICE-MAPPER (LVM)), Shaohua Li , linux-raid@vger.kernel.org (open list:SOFTWARE RAID (Multiple Disks) SUPPORT) Subject: [PATCH v1 12/54] dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE Date: Tue, 27 Dec 2016 23:56:01 +0800 Message-Id: <1482854250-13481-13-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 For BIO based DM, some targets aren't ready for dealing with bigger incoming bio than 1Mbyte, such as crypt target. Signed-off-by: Ming Lei --- drivers/md/dm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 3086da5664f3..6139bf7623f7 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -899,7 +899,16 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len) return -EINVAL; } - ti->max_io_len = (uint32_t) len; + /* + * BIO based queue uses its own splitting. When multipage bvecs + * is switched on, size of the incoming bio may be too big to + * be handled in some targets, such as crypt. + * + * When these targets are ready for the big bio, we can remove + * the limit. + */ + ti->max_io_len = min_t(uint32_t, len, + (BIO_MAX_PAGES * PAGE_SIZE)); return 0; }