[RFC PATCHv2 2/3] nvme: introduce multipath_head_always module param

Nilay Shroff nilay at linux.ibm.com
Mon Apr 28 23:26:05 PDT 2025



On 4/25/25 8:15 PM, Christoph Hellwig wrote:
> On Fri, Apr 25, 2025 at 04:03:09PM +0530, Nilay Shroff wrote:
>> +static int multipath_param_set(const char *val, const struct kernel_param *kp)
>> +{
>> +	int ret;
>> +
>> +	ret = param_set_bool(val, kp);
>> +	if (ret)
>> +		return ret;
>> +
>> +	if (multipath_head_always && !*(bool *)kp->arg) {
>> +		pr_err("Can't disable multipath when multipath_head_always is configured.\n");
>> +		*(bool *)kp->arg = true;
> 
> This reads much nicer if you add a local bool * variable and avoid
> all the casting, i.e.
> 
> 	bool *arg = kp->arg;
> 
> 	...
> 
> 	if (multipath_head_always && !*kp->arg) {
> 		pr_err("Can't disable multipath when multipath_head_always is configured.\n");
> 		*arg = true;
> 
>> +static int multipath_head_always_set(const char *val,
>> +		const struct kernel_param *kp)
>> +{
>> +	int ret;
>> +
>> +	ret = param_set_bool(val, kp);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	if (*(bool *)kp->arg)
>> +		multipath = true;
> 
> Same here.
> 
Agreed, will change in the next patch.

Thanks,
--Nilay



More information about the Linux-nvme mailing list