From: "Srivatsa S. Bhat" <srivatsa@csail.mit.edu>
To: Logan Gunthorpe <logang@deltatee.com>, gregkh@linuxfoundation.org
Cc: axboe@kernel.dk, jlayton@poochiereds.net, bfields@fieldses.org,
linux-kernel@vger.kernel.org
Subject: Re: Change in register_blkdev() behavior
Date: Thu, 1 Feb 2018 16:23:05 -0800 [thread overview]
Message-ID: <e23b4d8f-9391-d214-e370-548244339cfb@csail.mit.edu> (raw)
In-Reply-To: <ce6d8040-3a1e-4137-e7b1-2066b9e56f42@deltatee.com>
Hi Logan,
On 1/30/18 5:26 PM, Logan Gunthorpe wrote:
>
>
> 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.
>
Sounds good! Thank you!
By the way, I happened to notice a few minor issues with the
find_dynamic_major() function added by this patch series:
static int find_dynamic_major(void)
{
int i;
struct char_device_struct *cd;
for (i = ARRAY_SIZE(chrdevs)-1; i > CHRDEV_MAJOR_DYN_END; i--) {
^^^^
As far as I can see, _DYN_END is inclusive, so shouldn't this be >= ?
if (chrdevs[i] == NULL)
return i;
}
for (i = CHRDEV_MAJOR_DYN_EXT_START;
i > CHRDEV_MAJOR_DYN_EXT_END; i--) {
^^^^
Same here; I believe this should be >=
for (cd = chrdevs[major_to_index(i)]; cd; cd = cd->next)
if (cd->major == i)
break;
if (cd == NULL || cd->major != i)
^^^^^^^^
It seems that this latter condition is unnecessary, as it will never be
true. (We'll reach here only if cd == NULL or cd->major == i).
return i;
}
return -EBUSY;
}
Regards,
Srivatsa
next prev parent reply other threads:[~2018-02-02 0:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 0:56 Srivatsa S. Bhat
2018-01-31 1:26 ` Logan Gunthorpe
2018-02-02 0:23 ` Srivatsa S. Bhat [this message]
2018-02-02 1:10 ` Logan Gunthorpe
2018-02-02 2:17 ` Srivatsa S. Bhat
2018-02-02 6:12 ` Logan Gunthorpe
2018-01-31 14:24 ` Greg KH
2018-02-02 0:25 ` Srivatsa S. Bhat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e23b4d8f-9391-d214-e370-548244339cfb@csail.mit.edu \
--to=srivatsa@csail.mit.edu \
--cc=axboe@kernel.dk \
--cc=bfields@fieldses.org \
--cc=gregkh@linuxfoundation.org \
--cc=jlayton@poochiereds.net \
--cc=linux-kernel@vger.kernel.org \
--cc=logang@deltatee.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®