mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
scsi: target: Fix LUN/device R/W and total command stats
In commit9cf2317b79("scsi: target: Move I/O path stats to per CPU") I saw we sometimes use %u and also misread the spec. As a result I thought all the stats were supposed to be 32-bit only. However, for the majority of cases we support currently, the spec specifies u64 bit stats. This patch converts the stats changed in the commit above to u64. Fixes:9cf2317b79("scsi: target: Move I/O path stats to per CPU") Signed-off-by: Mike Christie <michael.christie@oracle.com> Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com> Link: https://patch.msgid.link/20250917221338.14813-2-michael.christie@oracle.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
3a86608788
commit
95aa2041c6
@@ -282,7 +282,7 @@ static ssize_t target_stat_lu_num_cmds_show(struct config_item *item,
|
||||
struct se_device *dev = to_stat_lu_dev(item);
|
||||
struct se_dev_io_stats *stats;
|
||||
unsigned int cpu;
|
||||
u32 cmds = 0;
|
||||
u64 cmds = 0;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
stats = per_cpu_ptr(dev->stats, cpu);
|
||||
@@ -290,7 +290,7 @@ static ssize_t target_stat_lu_num_cmds_show(struct config_item *item,
|
||||
}
|
||||
|
||||
/* scsiLuNumCommands */
|
||||
return snprintf(page, PAGE_SIZE, "%u\n", cmds);
|
||||
return snprintf(page, PAGE_SIZE, "%llu\n", cmds);
|
||||
}
|
||||
|
||||
static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item,
|
||||
@@ -299,7 +299,7 @@ static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item,
|
||||
struct se_device *dev = to_stat_lu_dev(item);
|
||||
struct se_dev_io_stats *stats;
|
||||
unsigned int cpu;
|
||||
u32 bytes = 0;
|
||||
u64 bytes = 0;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
stats = per_cpu_ptr(dev->stats, cpu);
|
||||
@@ -307,7 +307,7 @@ static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item,
|
||||
}
|
||||
|
||||
/* scsiLuReadMegaBytes */
|
||||
return snprintf(page, PAGE_SIZE, "%u\n", bytes >> 20);
|
||||
return snprintf(page, PAGE_SIZE, "%llu\n", bytes >> 20);
|
||||
}
|
||||
|
||||
static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item,
|
||||
@@ -316,7 +316,7 @@ static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item,
|
||||
struct se_device *dev = to_stat_lu_dev(item);
|
||||
struct se_dev_io_stats *stats;
|
||||
unsigned int cpu;
|
||||
u32 bytes = 0;
|
||||
u64 bytes = 0;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
stats = per_cpu_ptr(dev->stats, cpu);
|
||||
@@ -324,7 +324,7 @@ static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item,
|
||||
}
|
||||
|
||||
/* scsiLuWrittenMegaBytes */
|
||||
return snprintf(page, PAGE_SIZE, "%u\n", bytes >> 20);
|
||||
return snprintf(page, PAGE_SIZE, "%llu\n", bytes >> 20);
|
||||
}
|
||||
|
||||
static ssize_t target_stat_lu_resets_show(struct config_item *item, char *page)
|
||||
@@ -1044,7 +1044,7 @@ static ssize_t target_stat_auth_num_cmds_show(struct config_item *item,
|
||||
struct se_dev_entry *deve;
|
||||
unsigned int cpu;
|
||||
ssize_t ret;
|
||||
u32 cmds = 0;
|
||||
u64 cmds = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
deve = target_nacl_find_deve(nacl, lacl->mapped_lun);
|
||||
@@ -1059,7 +1059,7 @@ static ssize_t target_stat_auth_num_cmds_show(struct config_item *item,
|
||||
}
|
||||
|
||||
/* scsiAuthIntrOutCommands */
|
||||
ret = snprintf(page, PAGE_SIZE, "%u\n", cmds);
|
||||
ret = snprintf(page, PAGE_SIZE, "%llu\n", cmds);
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
}
|
||||
@@ -1073,7 +1073,7 @@ static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item,
|
||||
struct se_dev_entry *deve;
|
||||
unsigned int cpu;
|
||||
ssize_t ret;
|
||||
u32 bytes = 0;
|
||||
u64 bytes = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
deve = target_nacl_find_deve(nacl, lacl->mapped_lun);
|
||||
@@ -1088,7 +1088,7 @@ static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item,
|
||||
}
|
||||
|
||||
/* scsiAuthIntrReadMegaBytes */
|
||||
ret = snprintf(page, PAGE_SIZE, "%u\n", bytes >> 20);
|
||||
ret = snprintf(page, PAGE_SIZE, "%llu\n", bytes >> 20);
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item,
|
||||
struct se_dev_entry *deve;
|
||||
unsigned int cpu;
|
||||
ssize_t ret;
|
||||
u32 bytes = 0;
|
||||
u64 bytes = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
deve = target_nacl_find_deve(nacl, lacl->mapped_lun);
|
||||
@@ -1117,7 +1117,7 @@ static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item,
|
||||
}
|
||||
|
||||
/* scsiAuthIntrWrittenMegaBytes */
|
||||
ret = snprintf(page, PAGE_SIZE, "%u\n", bytes >> 20);
|
||||
ret = snprintf(page, PAGE_SIZE, "%llu\n", bytes >> 20);
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -671,9 +671,9 @@ struct se_lun_acl {
|
||||
};
|
||||
|
||||
struct se_dev_entry_io_stats {
|
||||
u32 total_cmds;
|
||||
u32 read_bytes;
|
||||
u32 write_bytes;
|
||||
u64 total_cmds;
|
||||
u64 read_bytes;
|
||||
u64 write_bytes;
|
||||
};
|
||||
|
||||
struct se_dev_entry {
|
||||
@@ -806,9 +806,9 @@ struct se_device_queue {
|
||||
};
|
||||
|
||||
struct se_dev_io_stats {
|
||||
u32 total_cmds;
|
||||
u32 read_bytes;
|
||||
u32 write_bytes;
|
||||
u64 total_cmds;
|
||||
u64 read_bytes;
|
||||
u64 write_bytes;
|
||||
};
|
||||
|
||||
struct se_device {
|
||||
|
||||
Reference in New Issue
Block a user