block: order /proc/devices by major number
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 16 Jun 2017 23:48:21 +0000 (17:48 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jul 2017 13:42:20 +0000 (15:42 +0200)
commit133d55cdb2f1f9e258d6dc34594a6c565f10b3fd
treeba2d42f4b9faaec0ddd8ffad9d5e73923b8ce39a
parent8a932f73e5b4227bf787474b44dc70b6961d6246
block: order /proc/devices by major number

Presently, the order of the block devices listed in /proc/devices is not
entirely sequential. If a block device has a major number greater than
BLKDEV_MAJOR_HASH_SIZE (255), it will be ordered as if its major were
module 255. For example, 511 appears after 1.

This patch cleans that up and prints each major number in the correct
order, regardless of where they are stored in the hash table.

In order to do this, we introduce BLKDEV_MAJOR_MAX as an artificial
limit (chosen to be 512). It will then print all devices in major
order number from 0 to the maximum.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jeff Layton <jlayton@poochiereds.net>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/genhd.c
fs/proc/devices.c
include/linux/fs.h