Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2455269imw; Wed, 6 Jul 2022 06:18:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uSJdMqLVEcm6+ims/Hda53FbrPP/l6WxkPm4HUd9kTkdZCRNZBgAvBC3bKZALM6KwGcbW/ X-Received: by 2002:a17:902:9348:b0:167:8e92:272f with SMTP id g8-20020a170902934800b001678e92272fmr46337183plp.77.1657113527389; Wed, 06 Jul 2022 06:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657113527; cv=none; d=google.com; s=arc-20160816; b=XfwIhwSSRt1nQDpfzs7m8czZpXvlQNx/OpPifFurKUBGA0NGb+SI1xBvAWgjdewYXs FDfbn3H374MhpFjJJyEU4xkm3ocwBbIwvJbefplLz/cVjcmsNAlegQpRbbpsIKLdxBxj VQqLG8MgTKMzm7yjTbvv6LkijBh9u0WSDbNKzjl+Oiaofh89GKrQezo+SJh3OnE7hOCP FRD4V/CWt8wwywbQSTEwjtr4jwk1GHVxjxHifWq74tmhxQssHpO7FzhItaEkzkuZ843O rNb7QE8BxsXOmhuFYhbbnrX5UbQtCzoGU04KFgy2JVAFWSbyv9Cya32EEbNBP1w5SSo1 O9iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ceb/IjE3f2UpwLk19hSDj3nYch41eBpR+eFC5bU92FE=; b=k9+LQ+sFuMR2m8TboA29Ku6Oi1gBYYcIEQ5DLqRx2+Un9LpBNh5Crjiag6GpHOCkFp 5SIc3NqYZP1jW+TiKOniJKAEBVH/wZQINHeOnJ0W88+OLBBxdJCvQ41i+j6MUz46wReL YWnbTkG7UMrdOX6/gdkGUvP1/DB2DCFgU+N779fybOSHlWl7paKIFjwoAtu2l+pcDr8Y sga1XziaLGt6F59xoygaWkusqAqW3sUK7ZmDJThGz6ZnH+pVHHKNxoJPGoG+L9kFd4+E UtyvAgKLgBmXQYkxNh+OmpHM/tw29eAEqTfAxTuztQtdqAimuc73TkS7qLrOhNHYlb6a fpIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=YhdEUAZh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a656445000000b0040cd256b7f4si23899194pgv.407.2022.07.06.06.18.35; Wed, 06 Jul 2022 06:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=YhdEUAZh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231561AbiGFNN7 (ORCPT + 99 others); Wed, 6 Jul 2022 09:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbiGFNN5 (ORCPT ); Wed, 6 Jul 2022 09:13:57 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56A6E02; Wed, 6 Jul 2022 06:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Ceb/IjE3f2UpwLk19hSDj3nYch41eBpR+eFC5bU92FE=; b=YhdEUAZhCJrQBU4y3VtlWZhG9q M/NtuJs2tbmvhuK+PEheiK4YG3+5YPcDU5AQKofCzm97vcH7MaR029+b7qVvXRSI8w++dPr+S6SBt FDcN2aHb16Ala+sz7hsGphQz29zTgmyOMpd5MDWSuxKXStBiyJme250NtVTFrGd8fyfWNqkva91oC w9c+cQiZ4ZLDJ0RDygSh5Rt4w1NYcDud9E2EKS+PZqXM1EVd0CqgWLTT6dXVWGZKmyaGi5zWdJ/3o /Un33xFNclg3UvkLx8RCxkTQbH0fqPguDMxOfHF1wo7pVqDjOvS9NQDn4SI82++GPYPgK+uSIxoXV j7ipfoMg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o94qc-00ACuR-Mb; Wed, 06 Jul 2022 13:13:42 +0000 Date: Wed, 6 Jul 2022 06:13:42 -0700 From: Christoph Hellwig To: Sergei Shtepa Cc: axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 15/20] block, blksnap: snapshot image block device Message-ID: References: <1655135593-1900-1-git-send-email-sergei.shtepa@veeam.com> <1655135593-1900-16-git-send-email-sergei.shtepa@veeam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1655135593-1900-16-git-send-email-sergei.shtepa@veeam.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +#include What do you need this for? > +static int new_minor(int *minor, void *ptr) > +{ > + int ret; > + > + idr_preload(GFP_KERNEL); > + spin_lock(&_minor_lock); > + > + ret = idr_alloc(&_minor_idr, ptr, 0, 1 << MINORBITS, GFP_NOWAIT); > + > + spin_unlock(&_minor_lock); > + idr_preload_end(); > + > + if (ret < 0) > + return ret; > + > + *minor = ret; > + return 0; > +} alloc_disk not automatically allocates minors for you if you don't set the ->major and ->first_minor fields, which could simply this a lot. > +static int snapimage_init_request(struct blk_mq_tag_set *set, > + struct request *rq, unsigned int hctx_idx, > + unsigned int numa_node) > +{ > + struct snapimage_cmd *cmd = blk_mq_rq_to_pdu(rq); > + > + kthread_init_work(&cmd->work, snapimage_queue_work); > + return 0; > +} I'm a little confused on why this both has a blk-mq interface and the new bio filter interface. Whow is going to submit I/O to this blk-mq interface? > + //.open = snapimage_open, > + //.ioctl = snapimage_ioctl, > + //.release = snapimage_close, Please don't leave commented out code around.