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

From: Zhiqiang Liu
Date: Mon Jan 20 2020 - 20:45:02 EST




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.