From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964968AbdACQnQ (ORCPT ); Tue, 3 Jan 2017 11:43:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34470 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935416AbdACQnN (ORCPT ); Tue, 3 Jan 2017 11:43:13 -0500 Date: Tue, 3 Jan 2017 11:43:13 -0500 From: Mike Snitzer To: Ming Lei Cc: Jens Axboe , linux-kernel@vger.kernel.org, Christoph Hellwig , linux-block@vger.kernel.org, "maintainer:DEVICE-MAPPER LVM, Shaohua Li , linux-raid@vger.kernel.org open list:SOFTWARE RAID Multiple DisksSUPPORT" , Alasdair Kergon Subject: Re: [PATCH v1 12/54] dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE Message-ID: <20170103164312.GA20421@redhat.com> References: <1482854250-13481-1-git-send-email-tom.leiming@gmail.com> <1482854250-13481-13-git-send-email-tom.leiming@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482854250-13481-13-git-send-email-tom.leiming@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 03 Jan 2017 16:43:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 27 2016 at 10:56am -0500, Ming Lei wrote: > 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; > } > -- > 2.7.4 dm_set_target_max_io_len() is already meant to be called by the .ctr hook for each DM target. So why not just have the dm-crypt target (and other targets if needed) pass your reduced $len? That way only targets that need to be fixed (e.g. dm-crypt) impose this limit.