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 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 58335C388F9 for ; Fri, 23 Oct 2020 10:31:34 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9BF9920EDD for ; Fri, 23 Oct 2020 10:31:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BF9920EDD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-eCxLL7OaMq-aPLV5fOHrVw-1; Fri, 23 Oct 2020 06:31:30 -0400 X-MC-Unique: eCxLL7OaMq-aPLV5fOHrVw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B89E11868408; Fri, 23 Oct 2020 10:31:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A28D5B4A2; Fri, 23 Oct 2020 10:31:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 08774180B657; Fri, 23 Oct 2020 10:31:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09NAVGhq013433 for ; Fri, 23 Oct 2020 06:31:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id D177E110F0CD; Fri, 23 Oct 2020 10:31:16 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC5DA110F0CB for ; Fri, 23 Oct 2020 10:31:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 15216858287 for ; Fri, 23 Oct 2020 10:31:12 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-jmeZCHwkN8iU55tahrZm9g-1; Fri, 23 Oct 2020 06:31:09 -0400 X-MC-Unique: jmeZCHwkN8iU55tahrZm9g-1 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) To: "hch@infradead.org" , Mike Snitzer 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> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 09NAVGhq013433 X-loop: dm-devel@redhat.com Cc: "jack@suse.cz" , "gustavo@embeddedor.com" , "linux-mm@kvack.org" , device-mapper development , "pavel@ucw.cz" , "steve@sk2.org" , "osandov@fb.com" , Alasdair G Kergon , "bvanassche@acm.org" , "Darrick J. Wong" , "len.brown@intel.com" , "linux-pm@vger.kernel.org" , "ming.lei@redhat.com" , "linux-block@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "viro@zeniv.linux.org.uk" , Sergei Shtepa , "koct9i@gmail.com" , "axboe@kernel.dk" , Damien Le Moal , Johannes Thumshirn , "rjw@rjwysocki.net" , "linux-kernel@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "tj@kernel.org" , "akpm@linux-foundation.org" Subject: Re: [dm-devel] [PATCH 0/2] block layer filter and block device snapshot module X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="utf-8"; Format="flowed" T24gMTAvMjMvMjAgMTE6MTMgQU0sIGhjaEBpbmZyYWRlYWQub3JnIHdyb3RlOgo+IE9uIFRodSwg T2N0IDIyLCAyMDIwIGF0IDAxOjU0OjE2UE0gLTA0MDAsIE1pa2UgU25pdHplciB3cm90ZToKPj4g T24gVGh1LCBPY3QgMjIsIDIwMjAgYXQgMTE6MTQgQU0gRGFycmljayBKLiBXb25nCj4+PiBTdHVw aWQgcXVlc3Rpb246IFdoeSBkb24ndCB5b3UgY2hhbmdlIHRoZSBibG9jayBsYXllciB0byBtYWtl IGl0Cj4+PiBwb3NzaWJsZSB0byBpbnNlcnQgZGV2aWNlIG1hcHBlciBkZXZpY2VzIGFmdGVyIHRo ZSBibG9ja2RldiBoYXMgYmVlbiBzZXQKPj4+IHVwPwo+Pgo+PiBOb3QgYSBzdHVwaWQgcXVlc3Rp b24uICBEZWZpbml0ZWx5IHNvbWV0aGluZyB0aGF0IHVzIERNIGRldmVsb3BlcnMKPj4gaGF2ZSB3 YW50ZWQgdG8gZG8gZm9yIGEgd2hpbGUuICBEZXZpbCBpcyBpb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