Re: Change in register_blkdev() behavior

From: Logan Gunthorpe
Date: Tue Jan 30 2018 - 20:27:04 EST




On 30/01/18 05:56 PM, Srivatsa S. Bhat wrote:
If the restriction on the major number was intentional, perhaps we
should get the LTP testcase modified for kernel versions >= 4.14.
Otherwise, we should fix register_blkdev to preserve the old behavior.
(I guess the same thing applies to commit 8a932f73e5b "char_dev: order
/proc/devices by major number" as well).

The restriction was put in place so the code that prints the devices doesn't have to run through every integer in order to print the devices in order.

Given the existing documented fixed numbers in [1] and that future new char devices should be using dynamic allocation, this seemed like a reasonable restriction.

It would be pretty trivial to increase the limit but, IMO, setting it to UINT_MAX seems a bit much. Especially given that a lot of the documentation and code still very much has remnants of the 256 limit. (The series that included this patch only just expanded the char dynamic range to above 256). So, I'd suggest the LTP test should change.

Logan


[1] Documentation/admin-guide/devices.txt