[Devel] [PATCH RHEL8 COMMIT] Revert "target: add extra counters for LUN statistics"

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 9 20:18:22 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.38
------>
commit e5513fd36a3fba11a55ff14d3850961dfd51f203
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Wed Jun 9 20:16:40 2021 +0300

    Revert "target: add extra counters for LUN statistics"
    
    This reverts commit 72b685ef31750a8d03faaf8e3bbc209d50d34ff5.
    
    It turned out that we/pStorage don't use tgtd anymore =>
    dropping patches.
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/target/target_core_device.c    |  2 --
 drivers/target/target_core_stat.c      | 51 ----------------------------------
 drivers/target/target_core_tmr.c       |  3 --
 drivers/target/target_core_transport.c | 24 ----------------
 include/target/target_core_base.h      |  8 ------
 5 files changed, 88 deletions(-)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 3871bee50362..b64d82261824 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -91,8 +91,6 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun)
 		se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD;
 		se_cmd->lun_ref_active = true;
 
-		atomic_long_inc(&se_cmd->se_lun->lun_stats.queue_cmds);
-
 		if ((se_cmd->data_direction == DMA_TO_DEVICE) &&
 		    deve->lun_access_ro) {
 			pr_err("TARGET_CORE[%s]: Detected WRITE_PROTECTED LUN"
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index 844d076b5c9f..8d9ceedfd455 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -683,35 +683,6 @@ static ssize_t target_stat_tgt_port_hs_in_cmds_show(struct config_item *item,
 	return ret;
 }
 
-#define DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(_name, _value)		\
-static ssize_t  target_stat_tgt_port_##_name##_show(			\
-	struct config_item *item, char *page)				\
-{									\
-	struct se_lun *lun = to_stat_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._value));	\
-	}								\
-	rcu_read_unlock();						\
-	return ret;							\
-}
-
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(read_bytes, tx_data_octets);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(write_bytes, rx_data_octets);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(read_cmds, read_cmds);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(write_cmds, write_cmds);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(bidi_cmds, bidi_cmds);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(read_errors, read_errors);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(write_errors, write_errors);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(bidi_errors, bidi_errors);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(aborts, aborts);
-DEV_STAT_TGT_PORT_STATS_SHOW_SIMPLE(queue_cmds, queue_cmds);
-
 CONFIGFS_ATTR_RO(target_stat_tgt_port_, inst);
 CONFIGFS_ATTR_RO(target_stat_tgt_port_, dev);
 CONFIGFS_ATTR_RO(target_stat_tgt_port_, indx);
@@ -722,17 +693,6 @@ 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);
 
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, read_bytes);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, write_bytes);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, read_cmds);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, write_cmds);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, bidi_cmds);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, read_errors);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, write_errors);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, bidi_errors);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, aborts);
-CONFIGFS_ATTR_RO(target_stat_tgt_port_, queue_cmds);
-
 static struct configfs_attribute *target_stat_scsi_tgt_port_attrs[] = {
 	&target_stat_tgt_port_attr_inst,
 	&target_stat_tgt_port_attr_dev,
@@ -743,17 +703,6 @@ static struct configfs_attribute *target_stat_scsi_tgt_port_attrs[] = {
 	&target_stat_tgt_port_attr_write_mbytes,
 	&target_stat_tgt_port_attr_read_mbytes,
 	&target_stat_tgt_port_attr_hs_in_cmds,
-
-	&target_stat_tgt_port_attr_read_bytes,
-	&target_stat_tgt_port_attr_write_bytes,
-	&target_stat_tgt_port_attr_read_cmds,
-	&target_stat_tgt_port_attr_write_cmds,
-	&target_stat_tgt_port_attr_bidi_cmds,
-	&target_stat_tgt_port_attr_read_errors,
-	&target_stat_tgt_port_attr_write_errors,
-	&target_stat_tgt_port_attr_bidi_errors,
-	&target_stat_tgt_port_attr_aborts,
-	&target_stat_tgt_port_attr_queue_cmds,
 	NULL,
 };
 
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index fc2343cb706a..076c167b8899 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -166,9 +166,6 @@ void core_tmr_abort_task(
 
 		target_put_cmd_and_wait(se_cmd);
 
-		if (se_cmd->se_cmd_flags & SCF_SE_LUN_CMD)
-			atomic_long_inc(&se_cmd->se_lun->lun_stats.aborts);
-
 		printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for"
 				" ref_tag: %llu\n", ref_tag);
 		tmr->response = TMR_FUNCTION_COMPLETE;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index f5afe9f34d86..2617bb3f7922 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -718,9 +718,6 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd)
 	if (!lun)
 		return;
 
-	if (cmd->se_cmd_flags & SCF_SE_LUN_CMD)
-		atomic_long_dec(&cmd->se_lun->lun_stats.queue_cmds);
-
 	if (cmpxchg(&cmd->lun_ref_active, true, false))
 		percpu_ref_put(&lun->lun_ref);
 }
@@ -729,19 +726,6 @@ static void target_complete_failure_work(struct work_struct *work)
 {
 	struct se_cmd *cmd = container_of(work, struct se_cmd, work);
 
-	switch (cmd->data_direction) {
-	case DMA_FROM_DEVICE:
-		atomic_long_inc(&cmd->se_lun->lun_stats.read_errors);
-		break;
-	case DMA_TO_DEVICE:
-		(cmd->se_cmd_flags & SCF_BIDI) ?
-			atomic_long_inc(&cmd->se_lun->lun_stats.bidi_errors) :
-			atomic_long_inc(&cmd->se_lun->lun_stats.write_errors);
-		break;
-	default:
-		break;
-	}
-
 	transport_generic_request_failure(cmd,
 			TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE);
 }
@@ -2391,9 +2375,6 @@ static void target_complete_ok_work(struct work_struct *work)
 
 		atomic_long_add(cmd->data_length,
 				&cmd->se_lun->lun_stats.tx_data_octets);
-
-		atomic_long_inc(&cmd->se_lun->lun_stats.read_cmds);
-
 		/*
 		 * Perform READ_STRIP of PI using software emulation when
 		 * backend had PI enabled, if the transport will not be
@@ -2418,11 +2399,6 @@ static void target_complete_ok_work(struct work_struct *work)
 	case DMA_TO_DEVICE:
 		atomic_long_add(cmd->data_length,
 				&cmd->se_lun->lun_stats.rx_data_octets);
-
-		(cmd->se_cmd_flags & SCF_BIDI) ?
-			atomic_long_inc(&cmd->se_lun->lun_stats.bidi_cmds) :
-			atomic_long_inc(&cmd->se_lun->lun_stats.write_cmds);
-
 		/*
 		 * Check if we need to send READ payload for BIDI-COMMAND
 		 */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 1d1f3a91c5d0..6d4a694f6ea7 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -715,14 +715,6 @@ struct scsi_port_stats {
 	atomic_long_t	cmd_pdus;
 	atomic_long_t	tx_data_octets;
 	atomic_long_t	rx_data_octets;
-	atomic_long_t	write_cmds;
-	atomic_long_t	read_cmds;
-	atomic_long_t	bidi_cmds;
-	atomic_long_t	write_errors;
-	atomic_long_t	read_errors;
-	atomic_long_t	bidi_errors;
-	atomic_long_t	queue_cmds;
-	atomic_long_t	aborts;
 };
 
 struct se_lun {


More information about the Devel mailing list