|
|
Log in / Subscribe / Register

simplify gendisk lookup and remove struct block_device aliases v4

From:  Christoph Hellwig <hch-AT-lst.de>
To:  Jens Axboe <axboe-AT-kernel.dk>
Subject:  simplify gendisk lookup and remove struct block_device aliases v4
Date:  Thu, 29 Oct 2020 15:58:23 +0100
Message-ID:  <20201029145841.144173-1-hch@lst.de>
Cc:  Greg Kroah-Hartman <gregkh-AT-linuxfoundation.org>, "Rafael J. Wysocki" <rafael-AT-kernel.org>, Denis Efremov <efremov-AT-linux.com>, "David S. Miller" <davem-AT-davemloft.net>, Song Liu <song-AT-kernel.org>, Al Viro <viro-AT-zeniv.linux.org.uk>, Finn Thain <fthain-AT-telegraphics.com.au>, Michael Schmitz <schmitzmic-AT-gmail.com>, linux-block-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, linux-ide-AT-vger.kernel.org, linux-raid-AT-vger.kernel.org, linux-scsi-AT-vger.kernel.org, linux-m68k-AT-lists.linux-m68k.org
Archive-link:  Article

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 v3:
 - keep kobj_map for char dev lookup for now, as the testbot found
   some very strange and unexplained regressions, so I'll get back to
   this later separately
 - fix a commit message typo

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



Copyright © 2020, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds