Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp350932pxk; Thu, 3 Sep 2020 01:02:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz07kGG3QMk3qc3W4dOVYd1fKAE0YQJUx1WBNo/G4cv1kTyoMH4ERlIqEF6q7MFayV/b4rX X-Received: by 2002:a17:906:9443:: with SMTP id z3mr963162ejx.156.1599120159318; Thu, 03 Sep 2020 01:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599120159; cv=none; d=google.com; s=arc-20160816; b=Z0W49Of5nfKLyRp9qMAEIz8Ffm7iL2ewhJjiMTCq/22V6BPeKs7MHkgc2gkly5qokq nWRdfvokc/Ch1aPQaMVDt1/sqgVPYTnzZHjW2aemDIdjnQjmErMPpiUvwlbLWMbesKMQ Na1Fuh37UqhTPWhwzS0FRkmSYokq3nmPmqt2CetZxLM0pd+fHP8xTTHzJ+CeVqhrRmLr wIc7PBoJi+hP0gHtdHhDEGpZRsINtl2ji9ApLvFUGU1Sq4N3nwvEm2RY4t1Ix4Kj4Y1R aXH5q1gDdwcn90hYcLUSR4nHfuDNAs5Z4tiOu83EQi3Wzo9KeSF9FMbrutGtMTL9UjQy tJWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cU305cxFBo6tm5/dcumAYM77XH5iQN9l01UIc+MQ8ms=; b=fnNw92JlDGq8aKS7gm2lz7CBMHYudq3VJANE4Ta1pKTfcW7NacR1kH+hG3hG0y8t8n MaGDBvNv+QawNty4MxNIKJs5UMMX+T7R4tJNq8Pqupc+k8fgzMNnRAQGYIfThL4+Bx0z 9VKC1XKUb3lX+mBMRZvyV3j/UJvzQm0kdIF8aUY1YA9FXkDTXWADUJAdwgrAD9itXyUC KGe2cx4IR/8jauj3nLiy9g7afYqtneupvrBvVmK3gJRRzzP6SS3ET5sJ1Ad7DLBWQ2YH EZ65Jr+cVMNjT7QTscaaL2DJhkv9QQ+G8wdulHi9WwREkgqiAUjrFrToHVGrR6MUWm8F kLlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=wWWW6aYY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu5si1383574ejb.750.2020.09.03.01.02.13; Thu, 03 Sep 2020 01:02:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=wWWW6aYY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728151AbgICIBi (ORCPT + 99 others); Thu, 3 Sep 2020 04:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbgICIBc (ORCPT ); Thu, 3 Sep 2020 04:01:32 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE2A3C061244; Thu, 3 Sep 2020 01:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=cU305cxFBo6tm5/dcumAYM77XH5iQN9l01UIc+MQ8ms=; b=wWWW6aYY0aagDmpZ1bPiSvTpQw hJm4tzGwj6/QUrIm6ZDBPRuSbs+oSQf3GZeEe/T3oMzvl2i2cvcS8HU0gIeJExqwloJMuvqD+tyUm /5CWj/mQRXnLWL5bbRHRR7Gi9/gFtwkcOHZ3GHFxXuEpkeqayyIaBuePt7xW9LIgNzgw5Nins47i/ BsLowowCTOTKIIDe5AHHnQPXyuGTLG+TkeO/7krX6/GSvGxLHKw2GijdhXLkTHKMxfpZWQrLqDvzM osFtIVQYGnxEdZK6JbWvEPOOyuMeoSfkEwcWm+DIPXHs7xcLJi5qnAJIEjerenE5BSTQzTmGTqMiy bNvKvSow==; Received: from [2001:4bb8:184:af1:c70:4a89:bc61:2] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDkBL-0006Zq-V2; Thu, 03 Sep 2020 08:01:20 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Denis Efremov , "David S. Miller" , Song Liu , Al Viro , Finn Thain , Michael Schmitz , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org Subject: simplify gendisk lookup and remove struct block_device aliases v3 Date: Thu, 3 Sep 2020 10:01:00 +0200 Message-Id: <20200903080119.441674-1-hch@lst.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, this series removes the annoying struct block_device aliases, which can happen for a bunch of old floppy drivers (and z2ram). In that case multiple struct block device instances for different dev_t's can point to the same gendisk, without being partitions. The cause for that is the probe/get callback registered through blk_register_regions. This series removes blk_register_region entirely, splitting it it into a simple xarray lookup of registered gendisks, and a probe callback stored in the major_names array that can be used for modprobe overrides or creating devices on demands when no gendisk is found. The old remapping is gone entirely, and instead the 4 remaining drivers just register a gendisk for each operating mode. In case of the two drivers that have lots of aliases that is done on-demand using the new probe callback, while for the other two I simply register all at probe time to keep things simple. Note that the m68k drivers are compile tested only. Changes since v2: - fix a wrong variable passed to ERR_PTR in the floppy driver - slightly adjust the del_gendisk cleanups to prepare for the next series touching this area Changes since v1: - add back a missing kobject_put in the cdev code - improve the xarray delete loops Diffstat: b/block/genhd.c | 183 +++++++-------- b/drivers/base/Makefile | 2 b/drivers/block/amiflop.c | 98 ++++---- b/drivers/block/ataflop.c | 135 +++++++---- b/drivers/block/brd.c | 39 --- b/drivers/block/floppy.c | 154 ++++++++---- b/drivers/block/loop.c | 30 -- b/drivers/block/swim.c | 17 - b/drivers/block/z2ram.c | 547 ++++++++++++++++++++++------------------------ b/drivers/ide/ide-probe.c | 66 ----- b/drivers/ide/ide-tape.c | 2 b/drivers/md/md.c | 21 - b/drivers/scsi/sd.c | 19 - b/fs/char_dev.c | 94 +++---- b/fs/dcache.c | 1 b/fs/internal.h | 5 b/include/linux/genhd.h | 12 - b/include/linux/ide.h | 3 drivers/base/map.c | 154 ------------ include/linux/kobj_map.h | 20 - 20 files changed, 686 insertions(+), 916 deletions(-)