Re: [PATCH 2/9] null_blk: check for valid submit_queue value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/31/23 04:01, Chaitanya Kulkarni wrote:
> 
>> I would do this:
>>
>> +#define NULL_PARAM(_name, _min, _max)                                  \
>> +static int null_param_##_name##_set(const char *s,                     \
>> +                                   const struct kernel_param *kp)      \
>> +{                                                                      \
>> +       return null_param_store_int(s, kp->arg, _min, _max);            \
>> +}                                                                      \
>> +                                                                       \
>> +static const struct kernel_param_ops null_##_name##_param_ops = {      \
>> +       .set    = null_param_##_name##_set,                             \
>> +       .get    = param_get_int,                                        \
>> +}
>> +
>>
>> And then have:
>>
>> +NULL_PARAM(submit_queues, 1, INT_MAX);
>> +NULL_PARAM(poll_queues, 1, num_online_cpus());
>> +NULL_PARAM(queue_mode, NULL_Q_BIO, NULL_Q_MQ);
>> +NULL_PARAM(gb, 1, INT_MAX);
>> +NULL_PARAM(bs, 512, 4096);
>> +NULL_PARAM(max_sectors, 1, INT_MAX);
>> +NULL_PARAM(irqmode, NULL_IRQ_NONE, NULL_IRQ_TIMER);
>> +NULL_PARAM(hw_qdepth, 1, INT_MAX);
>>
>> That can be done in a single patch and is overall a lot less code.
>>
> 
> I did the same thing at first, however it doesn't allow us to print
> the right module parameter specific error message which I
> to add in this series especially for  where this patch limits it
> nr_online_cpu().

Given that your changes are checking the value ranges only, it would not be hard
to craft a common error message and add it to the null_param_##_name##_set()
definition.

> 
> let me send out V2 with right error messages ...
> 
> -ck
> 
> 

-- 
Damien Le Moal
Western Digital Research





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux