From patchwork Sat Oct 29 08:08:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9403385 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 EC26E60587 for ; Sat, 29 Oct 2016 08:28:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7FB92A1EA for ; Sat, 29 Oct 2016 08:28:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA6B12A63F; Sat, 29 Oct 2016 08:28:06 +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 7197F2A1DD for ; Sat, 29 Oct 2016 08:28:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966270AbcJ2I1t (ORCPT ); Sat, 29 Oct 2016 04:27:49 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34689 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S942779AbcJ2IOI (ORCPT ); Sat, 29 Oct 2016 04:14:08 -0400 Received: by mail-pf0-f195.google.com with SMTP id u84so3379320pfj.1; Sat, 29 Oct 2016 01:14:07 -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=G7kzzd7bmIt+NfosL14wcdNEgg1jww8EVG5MxPLoEBg=; b=RrRp4gHHYZk5BOnJGDXIIKYTxAzSC/rfY4e2O2/TeV8xMNHhFi18ySPdQ7v0eypxY+ fEMjkM2LKjO8k8Jwvi/TFtXczzxM/ao4hD5I26EuAAMg/fZco5V7dxh/+m0z8YWy22sN rMFxJ1KX3m0SN5gNVQRfeIyxJ2WboRMfYc4ZW4i4SQptPWciiEA7bDrHAJP3269dDFLq Ldc/WwVfQ5c7tMSgt8SEhtHHRfbzqijH9vfqMtvBSvaEe/0sEXbdew+L5LrSUjDk1RYJ qXKlDT9yzyPwA0ce41sTueaTQNiVNk0gOnr0EhXEC9GvI/tFWGIk8xt4jDEvQMh/gKX4 70RA== 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=G7kzzd7bmIt+NfosL14wcdNEgg1jww8EVG5MxPLoEBg=; b=MzZivSG3ZQI+Y6jPM+i4n6eDHG9NNwjpCS5JQRLcbaAD9wppMLD79nI1EWNLCAgKA4 Tn+pNtW6vkp4ZOOajsLz4bk9+qfy4Z/271K+sSMzLmbqEj2qiYq49EsBB9iFuk500n44 gsUlyuZZTS1NfEoZg6Dr5KBDdk0WubnoxdEYvJfVbBhiZxezX23cmkz0GPnzNFMAoo2a AF9+xpRAzZFyKOP0aT9twLVCOMVvav5KPd+ReIhIsmxuVwJ5jOtuabvj/vXS3R7W9Y8C xH/60rK/iXJfPBYtHQQ11LClHS1aXptLq7bqHi3YV1zqR4bDQxWcd12RZb4b87EObdXw cVNA== X-Gm-Message-State: ABUngvd/SfHcylsN0+FGwdFwU4fkWqUSU3nXTnfrAN6ctAN8zvGNkPZFshyXaB2WgkANFw== X-Received: by 10.98.71.215 with SMTP id p84mr31742235pfi.59.1477728847406; Sat, 29 Oct 2016 01:14:07 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id o184sm23506924pfg.73.2016.10.29.01.14.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:14:06 -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 , 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 29/60] dm: limit the max bio size as BIO_SP_MAX_SECTORS << SECTOR_SHIFT Date: Sat, 29 Oct 2016 16:08:28 +0800 Message-Id: <1477728600-12938-30-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 For BIO based DM, some targets aren't ready for dealing with bigger incoming bio than 1Mbyte, such as crypt and log write targets. 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 ef7bf1dd6900..ce454c6c1a4e 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 and log write. + * + * When these targets are ready for the big bio, we can remove + * the limit. + */ + ti->max_io_len = min_t(uint32_t, len, + BIO_SP_MAX_SECTORS << SECTOR_SHIFT); return 0; }