From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id AC73D42066F for ; Mon, 24 May 2021 09:25:58 +0200 (CEST) Date: Mon, 24 May 2021 09:25:57 +0200 From: Christoph Hellwig To: Hannes Reinecke Message-ID: <20210524072557.GE23890@lst.de> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-14-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: nvdimm@lists.linux.dev, Ulf Hansson , Mike Snitzer , linux-nvme@lists.infradead.org, Song Liu , dm-devel@redhat.com, linux-bcache@vger.kernel.org, Christoph Hellwig , drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, Dave Jiang , Maxim Levitsky , Vishal Verma , Christian Borntraeger , Geert Uytterhoeven , Matias Bjorling , Nitin Gupta , Vasily Gorbik , linux-xtensa@linux-xtensa.org, Alex Dubov , Heiko Carstens , Coly Li , linux-block@vger.kernel.org, linux-m68k@lists.linux-m68k.org, Philip Kelleher , Dan Williams , Jens Axboe , Chris Zankel , linux-raid@vger.kernel.org, Max Filippov , linux-mmc@vger.kernel.org, Philipp Reisner , Jim Paris , Minchan Kim , Lars Ellenberg , linuxppc-dev@lists.ozlabs.org Subject: Re: [Drbd-dev] [PATCH 13/26] dm: convert to blk_alloc_disk/blk_cleanup_disk List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sun, May 23, 2021 at 10:10:34AM +0200, Hannes Reinecke wrote: > Can't these conditionals be merged into a single 'if (md->disk)'? > Eg like: > > if (md->disk) { > spin_lock(&_minor_lock); > md->disk->private_data = NULL; > spin_unlock(&_minor_lock); > del_gendisk(md->disk); > dm_queue_destroy_keyslot_manager(md->queue); > blk_cleanup_disk(md->queue); > } > > We're now always allocating 'md->disk' and 'md->queue' together, > so how can we end up in a situation where one is set without the other? I guess we could do that, not sure it is worth the churn, though.