From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751881AbdKVStg (ORCPT ); Wed, 22 Nov 2017 13:49:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9209 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbdKVStf (ORCPT ); Wed, 22 Nov 2017 13:49:35 -0500 Date: Wed, 22 Nov 2017 13:49:31 -0500 From: Mike Snitzer To: Mikulas Patocka Cc: NeilBrown , Jens Axboe , "linux-kernel@vger.kernel.org" , linux-block@vger.kernel.org, device-mapper development , Zdenek Kabelac Subject: Re: new patchset to eliminate DM's use of BIOSET_NEED_RESCUER Message-ID: <20171122184931.GA28348@redhat.com> References: <87a7zg31vx.fsf@notabene.neil.brown.name> <20171121013533.GA14520@redhat.com> <20171121121049.GA17014@redhat.com> <20171121124311.GA17243@redhat.com> <20171121194709.GA18903@redhat.com> <20171121225119.GA19630@redhat.com> <87bmjv0xos.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.28]); Wed, 22 Nov 2017 18:49:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 22 2017 at 1:24pm -0500, Mikulas Patocka wrote: > Another problem is this: > > struct bio *b = bio_clone_bioset(bio, GFP_NOIO, md->queue->bio_split); > bio_advance(b, (bio_sectors(b) - ci.sector_count) << 9); > bio_chain(b, bio); > > What if it blocks because the bioset is exhausted? > > The code basically builds a chain of bios of unlimited length (suppose for > example a case when we are splitting on every sector boundary, so there > will be one bio for every sector in the original bio), it could exhaust > the bioset easily. > > It would be better to use mechanism from md-raid that chains all the > sub-bios to the same master bio and doesn't create long chains of bios: > > if (max_sectors < bio_sectors(bio)) { > struct bio *split = bio_split(bio, max_sectors, > gfp, conf->bio_split); > bio_chain(split, bio); > generic_make_request(bio); > bio = split; > r1_bio->master_bio = bio; > r1_bio->sectors = max_sectors; > } I'd be happy to take an incremental patch that improves on this commit: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.16&id=b46d6a08f1ae7bf53e4cde28e0ccdf91567d432e But short of that I'll have to come back to this. Thanks, Mike