Re: [PATCH V3] brd: check and limit max_part par

Zhiqiang Liu
2020-01-21T01:45:01Z

On 2020/1/21 6:58, Ming Lei wrote:
> On Mon, Jan 20, 2020 at 09:14:50PM +0800, Zhiqiang Liu wrote:
>>>> +static inline void brd_check_and_reset_par(void)
>>>> +{
>>>> +       if (unlikely(!rd_nr))
>>>> +               rd_nr = 1;
>>>> +
>>>> +       if (unlikely(!max_part))
>>>> +               max_part = 1;
>>>
>>> Another limit is that 'max_part' needs to be divided exactly by (1U <<
>>> MINORBITS), something like:
>>>
>>> max_part = 1UL << fls(max_part)
>>
>> Do we have to limit that 'max_part' needs to be divided exactly by (1U <<
>>> MINORBITS)? As your suggestion, the i * max_part is larger than MINORMASK,
>> we can allocate from extended devt.
>
> Exact dividing is for reserving same minors for all disks with
> RAMDISK_MAJOR, otherwise there is still chance to get same dev_t when
> adding partitions.
>
> Extended devt is for covering more disks, not related with 'max_part'.
>

Thank you very much.
I will change that as you said.