Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Martin K. Petersen
> "Arnd" == Arnd Bergmann writes: Arnd> The fc_get_host_stats() function contains a complex conversion Arnd> from jiffies to timespec to seconds. As we try to get rid of uses Arnd> of struct timespec, we can clean this up and replace it with a Arnd> simpler computation. Arnd>

Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Martin K. Petersen
> "Arnd" == Arnd Bergmann writes: Arnd> The fc_get_host_stats() function contains a complex conversion Arnd> from jiffies to timespec to seconds. As we try to get rid of uses Arnd> of struct timespec, we can clean this up and replace it with a Arnd> simpler computation. Arnd> Simply

Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Bart Van Assche
On 06/20/2016 04:48 PM, Arnd Bergmann wrote: On Monday, June 20, 2016 3:54:06 PM CEST Bart Van Assche wrote: On 06/17/2016 05:47 PM, Arnd Bergmann wrote: - jiffies_to_timespec(jiffies, ); - jiffies_to_timespec(lport->boot_time, ); - fc_stats->seconds_since_last_reset = (v0.tv_sec -

Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Bart Van Assche
On 06/20/2016 04:48 PM, Arnd Bergmann wrote: On Monday, June 20, 2016 3:54:06 PM CEST Bart Van Assche wrote: On 06/17/2016 05:47 PM, Arnd Bergmann wrote: - jiffies_to_timespec(jiffies, ); - jiffies_to_timespec(lport->boot_time, ); - fc_stats->seconds_since_last_reset = (v0.tv_sec -

Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Arnd Bergmann
On Monday, June 20, 2016 3:54:06 PM CEST Bart Van Assche wrote: > On 06/17/2016 05:47 PM, Arnd Bergmann wrote: > > - jiffies_to_timespec(jiffies, ); > > - jiffies_to_timespec(lport->boot_time, ); > > - fc_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); > > +

Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Arnd Bergmann
On Monday, June 20, 2016 3:54:06 PM CEST Bart Van Assche wrote: > On 06/17/2016 05:47 PM, Arnd Bergmann wrote: > > - jiffies_to_timespec(jiffies, ); > > - jiffies_to_timespec(lport->boot_time, ); > > - fc_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); > > +

Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Bart Van Assche
On 06/17/2016 05:47 PM, Arnd Bergmann wrote: - jiffies_to_timespec(jiffies, ); - jiffies_to_timespec(lport->boot_time, ); - fc_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); + fc_stats->seconds_since_last_reset = (lport->boot_time - jiffies) / HZ; Does this

Re: [PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-20 Thread Bart Van Assche
On 06/17/2016 05:47 PM, Arnd Bergmann wrote: - jiffies_to_timespec(jiffies, ); - jiffies_to_timespec(lport->boot_time, ); - fc_stats->seconds_since_last_reset = (v0.tv_sec - v1.tv_sec); + fc_stats->seconds_since_last_reset = (lport->boot_time - jiffies) / HZ; Does this

[PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-17 Thread Arnd Bergmann
The fc_get_host_stats() function contains a complex conversion from jiffies to timespec to seconds. As we try to get rid of uses of struct timespec, we can clean this up and replace it with a simpler computation. Simply dividing the difference in jiffies by HZ is not only much more efficient, it

[PATCH] scsi: libfc: fix seconds_since_last_reset calculation

2016-06-17 Thread Arnd Bergmann
The fc_get_host_stats() function contains a complex conversion from jiffies to timespec to seconds. As we try to get rid of uses of struct timespec, we can clean this up and replace it with a simpler computation. Simply dividing the difference in jiffies by HZ is not only much more efficient, it