From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A10EBC55179 for ; Fri, 23 Oct 2020 10:31:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5574820EDD for ; Fri, 23 Oct 2020 10:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S462310AbgJWKbJ (ORCPT ); Fri, 23 Oct 2020 06:31:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:37798 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S462259AbgJWKbJ (ORCPT ); Fri, 23 Oct 2020 06:31:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A0192ABD1; Fri, 23 Oct 2020 10:31:07 +0000 (UTC) Subject: Re: [PATCH 0/2] block layer filter and block device snapshot module To: "hch@infradead.org" , Mike Snitzer Cc: "Darrick J. Wong" , Sergei Shtepa , Damien Le Moal , "axboe@kernel.dk" , "viro@zeniv.linux.org.uk" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "rjw@rjwysocki.net" , "len.brown@intel.com" , "pavel@ucw.cz" , "akpm@linux-foundation.org" , Johannes Thumshirn , "ming.lei@redhat.com" , "jack@suse.cz" , "tj@kernel.org" , "gustavo@embeddedor.com" , "bvanassche@acm.org" , "osandov@fb.com" , "koct9i@gmail.com" , "steve@sk2.org" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , "linux-mm@kvack.org" , device-mapper development , Alasdair G Kergon References: <1603271049-20681-1-git-send-email-sergei.shtepa@veeam.com> <71926887-5707-04a5-78a2-ffa2ee32bd68@suse.de> <20201021141044.GF20749@veeam.com> <20201022094402.GA21466@veeam.com> <20201022135213.GB21466@veeam.com> <20201022151418.GR9832@magnolia> <20201023091346.GA25115@infradead.org> From: Hannes Reinecke Message-ID: Date: Fri, 23 Oct 2020 12:31:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201023091346.GA25115@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On 10/23/20 11:13 AM, hch@infradead.org wrote: > On Thu, Oct 22, 2020 at 01:54:16PM -0400, Mike Snitzer wrote: >> On Thu, Oct 22, 2020 at 11:14 AM Darrick J. Wong >>> Stupid question: Why don't you change the block layer to make it >>> possible to insert device mapper devices after the blockdev has been set >>> up? >> >> Not a stupid question. Definitely something that us DM developers >> have wanted to do for a while. Devil is in the details but it is the >> right way forward. >> > > Yes, I think that is the right thing to do. And I don't think it should > be all that hard. All we'd need in the I/O path is something like the > pseudo-patch below, which will allow the interposer driver to resubmit > bios using submit_bio_noacct as long as the driver sets BIO_INTERPOSED. > > diff --git a/block/blk-core.c b/block/blk-core.c > index ac00d2fa4eb48d..3f6f1eb565e0a8 100644 > --- a/block/blk-core.c > +++ b/block/blk-core.c > @@ -1051,6 +1051,9 @@ blk_qc_t submit_bio_noacct(struct bio *bio) > return BLK_QC_T_NONE; > } > > + if (blk_has_interposer(bio->bi_disk) && > + !(bio->bi_flags & BIO_INTERPOSED)) > + return __submit_bio_interposed(bio); > if (!bio->bi_disk->fops->submit_bio) > return __submit_bio_noacct_mq(bio); > return __submit_bio_noacct(bio); > My thoughts went more into the direction of hooking into ->submit_bio, seeing that it's a NULL pointer for most (all?) block drivers. But sure, I'll check how the interposer approach would turn out. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer