Message ID | 1521625963-657195-1-git-send-email-zhangzhuoyu@cmss.chinamobile.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, The commit summary has a typo (cmd_puds). That said, this change isn't iSCSI specific, so using "pdu" here doesn't make much sense IMO. On Wed, 21 Mar 2018 17:52:43 +0800, Zhang Zhuoyu wrote: > Separate tx/rx cmd_pdus in order to distinguish LUN read/write IOPS. > > Signed-off-by: Zhang Zhuoyu <zhangzhuoyu@cmss.chinamobile.com> > --- > drivers/target/target_core_stat.c | 26 ++++++++++++++++++++++---- > drivers/target/target_core_transport.c | 11 ++++++++++- > include/target/target_core_base.h | 3 ++- > 3 files changed, 34 insertions(+), 6 deletions(-) > > diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c > index f0db91e..9099494 100644 > --- a/drivers/target/target_core_stat.c > +++ b/drivers/target/target_core_stat.c > @@ -706,7 +722,8 @@ static ssize_t target_stat_tgt_port_hs_in_cmds_show(struct config_item *item, > CONFIGFS_ATTR_RO(target_stat_tgt_port_, indx); > CONFIGFS_ATTR_RO(target_stat_tgt_port_, name); > CONFIGFS_ATTR_RO(target_stat_tgt_port_, port_index); > -CONFIGFS_ATTR_RO(target_stat_tgt_port_, in_cmds); > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, tx_cmds); > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, rx_cmds); I don't think the in_cmds metric should be deleted here. It could be calculated on the fly via tx_cmds + rx_cmds + nodata_cmds. Cheers, David -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 5 Apr 2018 13:12:12 +0200, David Disseldorp wrote: > > -CONFIGFS_ATTR_RO(target_stat_tgt_port_, in_cmds); > > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, tx_cmds); > > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, rx_cmds); > > I don't think the in_cmds metric should be deleted here. It could be > calculated on the fly via tx_cmds + rx_cmds + nodata_cmds. @Zhang Zhuoyu: How about something like the following? https://git.samba.org/?p=ddiss/linux.git;a=commitdiff;h=73723ccf433424721830797d70cfb88d4596e0fc ...this keeps the in_cmds metric, and renames tx/rx_cmds read/write_cmds respectively. read/write_cmds is still a bit ambiguous, as it refers to the command data direction rather than SCSI READ/WRITE CDBs, but IMO it's clearer, and more consistent with the read/write_mbytes metrics. Cheers, David -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: David Disseldorp [mailto:ddiss@suse.de] > Sent: Friday, April 6, 2018 8:10 PM > To: Zhang Zhuoyu <zhangzhuoyu@cmss.chinamobile.com> > Cc: nab@linux-iscsi.org; linux-scsi@vger.kernel.org; target- > devel@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH 1/1] target:separate tx/rx cmd_puds > > On Thu, 5 Apr 2018 13:12:12 +0200, David Disseldorp wrote: > > > > -CONFIGFS_ATTR_RO(target_stat_tgt_port_, in_cmds); > > > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, tx_cmds); > > > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, rx_cmds); > > > > I don't think the in_cmds metric should be deleted here. It could be > > calculated on the fly via tx_cmds + rx_cmds + nodata_cmds. > > @Zhang Zhuoyu: How about something like the following? > https://git.samba.org/?p=ddiss/linux.git;a=commitdiff;h=73723ccf433424721 > 830797d70cfb88d4596e0fc > Mmm... This patch is much better. Looks good to me. Zhuoyu > ...this keeps the in_cmds metric, and renames tx/rx_cmds read/write_cmds > respectively. read/write_cmds is still a bit ambiguous, as it refers to the > command data direction rather than SCSI READ/WRITE CDBs, but IMO it's > clearer, and more consistent with the read/write_mbytes metrics. > > Cheers, David -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[replying to an old thread] On Sun, 8 Apr 2018 11:57:18 +0800, Zhang Zhuoyu wrote: > > On Thu, 5 Apr 2018 13:12:12 +0200, David Disseldorp wrote: > > > > > > -CONFIGFS_ATTR_RO(target_stat_tgt_port_, in_cmds); > > > > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, tx_cmds); > > > > +CONFIGFS_ATTR_RO(target_stat_tgt_port_, rx_cmds); > > > > > > I don't think the in_cmds metric should be deleted here. It could be > > > calculated on the fly via tx_cmds + rx_cmds + nodata_cmds. > > > > @Zhang Zhuoyu: How about something like the following? > > https://git.samba.org/?p=ddiss/linux.git;a=commitdiff;h=73723ccf433424721 > > 830797d70cfb88d4596e0fc > > > > Mmm... This patch is much better. > Looks good to me. Looks like I never followed up with a proper submission for this patch. I'll do so later today. Cheers, David
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c index f0db91e..9099494 100644 --- a/drivers/target/target_core_stat.c +++ b/drivers/target/target_core_stat.c @@ -636,7 +636,7 @@ static ssize_t target_stat_tgt_port_port_index_show(struct config_item *item, return ret; } -static ssize_t target_stat_tgt_port_in_cmds_show(struct config_item *item, +static ssize_t target_stat_tgt_port_tx_cmds_show(struct config_item *item, char *page) { struct se_lun *lun = to_stat_tgt_port(item); @@ -647,7 +647,23 @@ static ssize_t target_stat_tgt_port_in_cmds_show(struct config_item *item, dev = rcu_dereference(lun->lun_se_dev); if (dev) ret = snprintf(page, PAGE_SIZE, "%lu\n", - atomic_long_read(&lun->lun_stats.cmd_pdus)); + atomic_long_read(&lun->lun_stats.tx_cmd_pdus)); + rcu_read_unlock(); + return ret; +} + +static ssize_t target_stat_tgt_port_rx_cmds_show(struct config_item *item, + char *page) +{ + struct se_lun *lun = to_stat_tgt_port(item); + struct se_device *dev; + ssize_t ret = -ENODEV; + + rcu_read_lock(); + dev = rcu_dereference(lun->lun_se_dev); + if (dev) + ret = snprintf(page, PAGE_SIZE, "%lu\n", + atomic_long_read(&lun->lun_stats.rx_cmd_pdus)); rcu_read_unlock(); return ret; } @@ -706,7 +722,8 @@ static ssize_t target_stat_tgt_port_hs_in_cmds_show(struct config_item *item, CONFIGFS_ATTR_RO(target_stat_tgt_port_, indx); CONFIGFS_ATTR_RO(target_stat_tgt_port_, name); CONFIGFS_ATTR_RO(target_stat_tgt_port_, port_index); -CONFIGFS_ATTR_RO(target_stat_tgt_port_, in_cmds); +CONFIGFS_ATTR_RO(target_stat_tgt_port_, tx_cmds); +CONFIGFS_ATTR_RO(target_stat_tgt_port_, rx_cmds); CONFIGFS_ATTR_RO(target_stat_tgt_port_, write_mbytes); CONFIGFS_ATTR_RO(target_stat_tgt_port_, read_mbytes); CONFIGFS_ATTR_RO(target_stat_tgt_port_, hs_in_cmds); @@ -717,7 +734,8 @@ static ssize_t target_stat_tgt_port_hs_in_cmds_show(struct config_item *item, &target_stat_tgt_port_attr_indx, &target_stat_tgt_port_attr_name, &target_stat_tgt_port_attr_port_index, - &target_stat_tgt_port_attr_in_cmds, + &target_stat_tgt_port_attr_tx_cmds, + &target_stat_tgt_port_attr_rx_cmds, &target_stat_tgt_port_attr_write_mbytes, &target_stat_tgt_port_attr_read_mbytes, &target_stat_tgt_port_attr_hs_in_cmds, diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 74b646f..79cb96f 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1356,7 +1356,16 @@ void transport_init_se_cmd( return ret; cmd->se_cmd_flags |= SCF_SUPPORTED_SAM_OPCODE; - atomic_long_inc(&cmd->se_lun->lun_stats.cmd_pdus); + switch (cmd->data_direction) { + case DMA_FROM_DEVICE: + atomic_long_inc(&cmd->se_lun->lun_stats.tx_cmd_pdus); + break; + case DMA_TO_DEVICE: + atomic_long_inc(&cmd->se_lun->lun_stats.rx_cmd_pdus); + break; + default: + break; + } return 0; } EXPORT_SYMBOL(target_setup_cmd_from_cdb); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 9f9f590..6a0a2a7 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -698,7 +698,8 @@ struct se_port_stat_grps { }; struct scsi_port_stats { - atomic_long_t cmd_pdus; + atomic_long_t tx_cmd_pdus; + atomic_long_t rx_cmd_pdus; atomic_long_t tx_data_octets; atomic_long_t rx_data_octets; };
Separate tx/rx cmd_pdus in order to distinguish LUN read/write IOPS. Signed-off-by: Zhang Zhuoyu <zhangzhuoyu@cmss.chinamobile.com> --- drivers/target/target_core_stat.c | 26 ++++++++++++++++++++++---- drivers/target/target_core_transport.c | 11 ++++++++++- include/target/target_core_base.h | 3 ++- 3 files changed, 34 insertions(+), 6 deletions(-)