diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2018-01-17 10:16:48 -0500 |
|---|---|---|
| committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-01-22 20:03:57 -0500 |
| commit | 22807aa812a65a7b859187e0fc6cfa0802a858c4 (patch) | |
| tree | f261defe3bc0491ae296345fcf28672061bc1ba0 | |
| parent | e89cabf26e1cdd5c612b6c21547b3e79b4ac1038 (diff) | |
scsi: fnic: use 64-bit timestamps
struct timespec is deprecated since it overflows in 2038 on 32-bit
architectures, so we should use timespec64 consistently.
I'm slightly adapting the format strings here, to make sure we print the
nanoseconds with the correct number of leading zeroes.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| -rw-r--r-- | drivers/scsi/fnic/fnic_debugfs.c | 2 | ||||
| -rw-r--r-- | drivers/scsi/fnic/fnic_stats.h | 4 | ||||
| -rw-r--r-- | drivers/scsi/fnic/fnic_trace.c | 58 |
3 files changed, 32 insertions, 32 deletions
diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index 9858484dd126..6d3e1cb4fea6 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c | |||
| @@ -614,7 +614,7 @@ static ssize_t fnic_reset_stats_write(struct file *file, | |||
| 614 | sizeof(struct io_path_stats) - sizeof(u64)); | 614 | sizeof(struct io_path_stats) - sizeof(u64)); |
| 615 | memset(fw_stats_p+1, 0, | 615 | memset(fw_stats_p+1, 0, |
| 616 | sizeof(struct fw_stats) - sizeof(u64)); | 616 | sizeof(struct fw_stats) - sizeof(u64)); |
| 617 | getnstimeofday(&stats->stats_timestamps.last_reset_time); | 617 | ktime_get_real_ts64(&stats->stats_timestamps.last_reset_time); |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | (*ppos)++; | 620 | (*ppos)++; |
diff --git a/drivers/scsi/fnic/fnic_stats.h b/drivers/scsi/fnic/fnic_stats.h index e007feedbf72..9daa6ada6fa0 100644 --- a/drivers/scsi/fnic/fnic_stats.h +++ b/drivers/scsi/fnic/fnic_stats.h | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | #define _FNIC_STATS_H_ | 18 | #define _FNIC_STATS_H_ |
| 19 | 19 | ||
| 20 | struct stats_timestamps { | 20 | struct stats_timestamps { |
| 21 | struct timespec last_reset_time; | 21 | struct timespec64 last_reset_time; |
| 22 | struct timespec last_read_time; | 22 | struct timespec64 last_read_time; |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | struct io_path_stats { | 25 | struct io_path_stats { |
diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index 4826f596cb31..abddde11982b 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c | |||
| @@ -111,7 +111,7 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) | |||
| 111 | int len = 0; | 111 | int len = 0; |
| 112 | unsigned long flags; | 112 | unsigned long flags; |
| 113 | char str[KSYM_SYMBOL_LEN]; | 113 | char str[KSYM_SYMBOL_LEN]; |
| 114 | struct timespec val; | 114 | struct timespec64 val; |
| 115 | fnic_trace_data_t *tbp; | 115 | fnic_trace_data_t *tbp; |
| 116 | 116 | ||
| 117 | spin_lock_irqsave(&fnic_trace_lock, flags); | 117 | spin_lock_irqsave(&fnic_trace_lock, flags); |
| @@ -129,10 +129,10 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) | |||
| 129 | /* Convert function pointer to function name */ | 129 | /* Convert function pointer to function name */ |
| 130 | if (sizeof(unsigned long) < 8) { | 130 | if (sizeof(unsigned long) < 8) { |
| 131 | sprint_symbol(str, tbp->fnaddr.low); | 131 | sprint_symbol(str, tbp->fnaddr.low); |
| 132 | jiffies_to_timespec(tbp->timestamp.low, &val); | 132 | jiffies_to_timespec64(tbp->timestamp.low, &val); |
| 133 | } else { | 133 | } else { |
| 134 | sprint_symbol(str, tbp->fnaddr.val); | 134 | sprint_symbol(str, tbp->fnaddr.val); |
| 135 | jiffies_to_timespec(tbp->timestamp.val, &val); | 135 | jiffies_to_timespec64(tbp->timestamp.val, &val); |
| 136 | } | 136 | } |
| 137 | /* | 137 | /* |
| 138 | * Dump trace buffer entry to memory file | 138 | * Dump trace buffer entry to memory file |
| @@ -140,8 +140,8 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) | |||
| 140 | */ | 140 | */ |
| 141 | len += snprintf(fnic_dbgfs_prt->buffer + len, | 141 | len += snprintf(fnic_dbgfs_prt->buffer + len, |
| 142 | (trace_max_pages * PAGE_SIZE * 3) - len, | 142 | (trace_max_pages * PAGE_SIZE * 3) - len, |
| 143 | "%16lu.%16lu %-50s %8x %8x %16llx %16llx " | 143 | "%16llu.%09lu %-50s %8x %8x %16llx %16llx " |
| 144 | "%16llx %16llx %16llx\n", val.tv_sec, | 144 | "%16llx %16llx %16llx\n", (u64)val.tv_sec, |
| 145 | val.tv_nsec, str, tbp->host_no, tbp->tag, | 145 | val.tv_nsec, str, tbp->host_no, tbp->tag, |
| 146 | tbp->data[0], tbp->data[1], tbp->data[2], | 146 | tbp->data[0], tbp->data[1], tbp->data[2], |
| 147 | tbp->data[3], tbp->data[4]); | 147 | tbp->data[3], tbp->data[4]); |
| @@ -171,10 +171,10 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) | |||
| 171 | /* Convert function pointer to function name */ | 171 | /* Convert function pointer to function name */ |
| 172 | if (sizeof(unsigned long) < 8) { | 172 | if (sizeof(unsigned long) < 8) { |
| 173 | sprint_symbol(str, tbp->fnaddr.low); | 173 | sprint_symbol(str, tbp->fnaddr.low); |
| 174 | jiffies_to_timespec(tbp->timestamp.low, &val); | 174 | jiffies_to_timespec64(tbp->timestamp.low, &val); |
| 175 | } else { | 175 | } else { |
| 176 | sprint_symbol(str, tbp->fnaddr.val); | 176 | sprint_symbol(str, tbp->fnaddr.val); |
| 177 | jiffies_to_timespec(tbp->timestamp.val, &val); | 177 | jiffies_to_timespec64(tbp->timestamp.val, &val); |
| 178 | } | 178 | } |
| 179 | /* | 179 | /* |
| 180 | * Dump trace buffer entry to memory file | 180 | * Dump trace buffer entry to memory file |
| @@ -182,8 +182,8 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) | |||
| 182 | */ | 182 | */ |
| 183 | len += snprintf(fnic_dbgfs_prt->buffer + len, | 183 | len += snprintf(fnic_dbgfs_prt->buffer + len, |
| 184 | (trace_max_pages * PAGE_SIZE * 3) - len, | 184 | (trace_max_pages * PAGE_SIZE * 3) - len, |
| 185 | "%16lu.%16lu %-50s %8x %8x %16llx %16llx " | 185 | "%16llu.%09lu %-50s %8x %8x %16llx %16llx " |
| 186 | "%16llx %16llx %16llx\n", val.tv_sec, | 186 | "%16llx %16llx %16llx\n", (u64)val.tv_sec, |
| 187 | val.tv_nsec, str, tbp->host_no, tbp->tag, | 187 | val.tv_nsec, str, tbp->host_no, tbp->tag, |
| 188 | tbp->data[0], tbp->data[1], tbp->data[2], | 188 | tbp->data[0], tbp->data[1], tbp->data[2], |
| 189 | tbp->data[3], tbp->data[4]); | 189 | tbp->data[3], tbp->data[4]); |
| @@ -217,29 +217,29 @@ int fnic_get_stats_data(struct stats_debug_info *debug, | |||
| 217 | { | 217 | { |
| 218 | int len = 0; | 218 | int len = 0; |
| 219 | int buf_size = debug->buf_size; | 219 | int buf_size = debug->buf_size; |
| 220 | struct timespec val1, val2; | 220 | struct timespec64 val1, val2; |
| 221 | 221 | ||
| 222 | getnstimeofday(&val1); | 222 | ktime_get_real_ts64(&val1); |
| 223 | len = snprintf(debug->debug_buffer + len, buf_size - len, | 223 | len = snprintf(debug->debug_buffer + len, buf_size - len, |
| 224 | "------------------------------------------\n" | 224 | "------------------------------------------\n" |
| 225 | "\t\tTime\n" | 225 | "\t\tTime\n" |
| 226 | "------------------------------------------\n"); | 226 | "------------------------------------------\n"); |
| 227 | 227 | ||
| 228 | len += snprintf(debug->debug_buffer + len, buf_size - len, | 228 | len += snprintf(debug->debug_buffer + len, buf_size - len, |
| 229 | "Current time : [%ld:%ld]\n" | 229 | "Current time : [%lld:%ld]\n" |
| 230 | "Last stats reset time: [%ld:%ld]\n" | 230 | "Last stats reset time: [%lld:%09ld]\n" |
| 231 | "Last stats read time: [%ld:%ld]\n" | 231 | "Last stats read time: [%lld:%ld]\n" |
| 232 | "delta since last reset: [%ld:%ld]\n" | 232 | "delta since last reset: [%lld:%ld]\n" |
| 233 | "delta since last read: [%ld:%ld]\n", | 233 | "delta since last read: [%lld:%ld]\n", |
| 234 | val1.tv_sec, val1.tv_nsec, | 234 | (s64)val1.tv_sec, val1.tv_nsec, |
| 235 | stats->stats_timestamps.last_reset_time.tv_sec, | 235 | (s64)stats->stats_timestamps.last_reset_time.tv_sec, |
| 236 | stats->stats_timestamps.last_reset_time.tv_nsec, | 236 | stats->stats_timestamps.last_reset_time.tv_nsec, |
| 237 | stats->stats_timestamps.last_read_time.tv_sec, | 237 | (s64)stats->stats_timestamps.last_read_time.tv_sec, |
| 238 | stats->stats_timestamps.last_read_time.tv_nsec, | 238 | stats->stats_timestamps.last_read_time.tv_nsec, |
| 239 | timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_sec, | 239 | (s64)timespec64_sub(val1, stats->stats_timestamps.last_reset_time).tv_sec, |
| 240 | timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_nsec, | 240 | timespec64_sub(val1, stats->stats_timestamps.last_reset_time).tv_nsec, |
| 241 | timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_sec, | 241 | (s64)timespec64_sub(val1, stats->stats_timestamps.last_read_time).tv_sec, |
| 242 | timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_nsec); | 242 | timespec64_sub(val1, stats->stats_timestamps.last_read_time).tv_nsec); |
| 243 | 243 | ||
| 244 | stats->stats_timestamps.last_read_time = val1; | 244 | stats->stats_timestamps.last_read_time = val1; |
| 245 | 245 | ||
| @@ -403,12 +403,12 @@ int fnic_get_stats_data(struct stats_debug_info *debug, | |||
| 403 | "\t\tOther Important Statistics\n" | 403 | "\t\tOther Important Statistics\n" |
| 404 | "------------------------------------------\n"); | 404 | "------------------------------------------\n"); |
| 405 | 405 | ||
| 406 | jiffies_to_timespec(stats->misc_stats.last_isr_time, &val1); | 406 | jiffies_to_timespec64(stats->misc_stats.last_isr_time, &val1); |
| 407 | jiffies_to_timespec(stats->misc_stats.last_ack_time, &val2); | 407 | jiffies_to_timespec64(stats->misc_stats.last_ack_time, &val2); |
| 408 | 408 | ||
| 409 | len += snprintf(debug->debug_buffer + len, buf_size - len, | 409 | len += snprintf(debug->debug_buffer + len, buf_size - len, |
| 410 | "Last ISR time: %llu (%8lu.%8lu)\n" | 410 | "Last ISR time: %llu (%8llu.%09lu)\n" |
| 411 | "Last ACK time: %llu (%8lu.%8lu)\n" | 411 | "Last ACK time: %llu (%8llu.%09lu)\n" |
| 412 | "Number of ISRs: %lld\n" | 412 | "Number of ISRs: %lld\n" |
| 413 | "Maximum CQ Entries: %lld\n" | 413 | "Maximum CQ Entries: %lld\n" |
| 414 | "Number of ACK index out of range: %lld\n" | 414 | "Number of ACK index out of range: %lld\n" |
| @@ -425,9 +425,9 @@ int fnic_get_stats_data(struct stats_debug_info *debug, | |||
| 425 | "Number of rport not ready: %lld\n" | 425 | "Number of rport not ready: %lld\n" |
| 426 | "Number of receive frame errors: %lld\n", | 426 | "Number of receive frame errors: %lld\n", |
| 427 | (u64)stats->misc_stats.last_isr_time, | 427 | (u64)stats->misc_stats.last_isr_time, |
| 428 | val1.tv_sec, val1.tv_nsec, | 428 | (s64)val1.tv_sec, val1.tv_nsec, |
| 429 | (u64)stats->misc_stats.last_ack_time, | 429 | (u64)stats->misc_stats.last_ack_time, |
| 430 | val2.tv_sec, val2.tv_nsec, | 430 | (s64)val2.tv_sec, val2.tv_nsec, |
| 431 | (u64)atomic64_read(&stats->misc_stats.isr_count), | 431 | (u64)atomic64_read(&stats->misc_stats.isr_count), |
| 432 | (u64)atomic64_read(&stats->misc_stats.max_cq_entries), | 432 | (u64)atomic64_read(&stats->misc_stats.max_cq_entries), |
| 433 | (u64)atomic64_read(&stats->misc_stats.ack_index_out_of_range), | 433 | (u64)atomic64_read(&stats->misc_stats.ack_index_out_of_range), |
