Re: [PATCH 10/14] block/mq-deadline: Improve the sysfs show and store macros

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

 



On 2021/06/10 1:54, Bart Van Assche wrote:
> On 6/8/21 9:46 PM, Damien Le Moal wrote:
>> On 2021/06/09 8:07, Bart Van Assche wrote:
>>> +#define SHOW_INT(__FUNC, __VAR)						\
>>>  static ssize_t __FUNC(struct elevator_queue *e, char *page)		\
>>>  {									\
>>>  	struct deadline_data *dd = e->elevator_data;			\
>>> -	int __data = __VAR;						\
>>> -	if (__CONV)							\
>>> -		__data = jiffies_to_msecs(__data);			\
>>> -	return deadline_var_show(__data, (page));			\
>>> -}
>>> -SHOW_FUNCTION(deadline_read_expire_show, dd->fifo_expire[DD_READ], 1);
>>> -SHOW_FUNCTION(deadline_write_expire_show, dd->fifo_expire[DD_WRITE], 1);
>>> -SHOW_FUNCTION(deadline_writes_starved_show, dd->writes_starved, 0);
>>> -SHOW_FUNCTION(deadline_front_merges_show, dd->front_merges, 0);
>>> -SHOW_FUNCTION(deadline_fifo_batch_show, dd->fifo_batch, 0);
>>> -#undef SHOW_FUNCTION
>>> +									\
>>> +	return sysfs_emit((page), "%d\n", __VAR);			\
>>> +}
>>> +#define SHOW_JIFFIES(__FUNC, __VAR) SHOW_INT(__FUNC, jiffies_to_msecs(__VAR))
>>
>> jiffies_to_msecs() returns an unsigned int but sysfs_emit() in SHOW_INT() uses a
>> %d format. That will cause problems, no ?
> 
> The corresponding store functions restrict values that represent a time
> in jiffies to the interval [0, INT_MAX] milliseconds so I think that
> using %d to format a time in milliseconds is fine.

Missed that part :) OK then.

> 
> Thanks,
> 
> Bart.
> 


-- 
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