Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Mar 2019 03:17:23 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r344717 - stable/12/sys/cam/ctl
Message-ID:  <201903020317.x223HNOY058283@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Mar  2 03:17:23 2019
New Revision: 344717
URL: https://svnweb.freebsd.org/changeset/base/344717

Log:
  MFC r344480: Remove disabled CTL_LEGACY_STATS support.
  
  It was not only disabled for quite a while, but also appeared to be broken
  at r325517, when maximum number of ports was made configurable.

Modified:
  stable/12/sys/cam/ctl/ctl.c
  stable/12/sys/cam/ctl/ctl_ioctl.h
  stable/12/sys/cam/ctl/ctl_private.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl.c
==============================================================================
--- stable/12/sys/cam/ctl/ctl.c	Sat Mar  2 01:51:41 2019	(r344716)
+++ stable/12/sys/cam/ctl/ctl.c	Sat Mar  2 03:17:23 2019	(r344717)
@@ -2743,39 +2743,6 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, 
 #endif /* CTL_IO_DELAY */
 		break;
 	}
-#ifdef CTL_LEGACY_STATS
-	case CTL_GETSTATS: {
-		struct ctl_stats *stats = (struct ctl_stats *)addr;
-		int i;
-
-		/*
-		 * XXX KDM no locking here.  If the LUN list changes,
-		 * things can blow up.
-		 */
-		i = 0;
-		stats->status = CTL_SS_OK;
-		stats->fill_len = 0;
-		STAILQ_FOREACH(lun, &softc->lun_list, links) {
-			if (stats->fill_len + sizeof(lun->legacy_stats) >
-			    stats->alloc_len) {
-				stats->status = CTL_SS_NEED_MORE_SPACE;
-				break;
-			}
-			retval = copyout(&lun->legacy_stats, &stats->lun_stats[i++],
-					 sizeof(lun->legacy_stats));
-			if (retval != 0)
-				break;
-			stats->fill_len += sizeof(lun->legacy_stats);
-		}
-		stats->num_luns = softc->num_luns;
-		stats->flags = CTL_STATS_FLAG_NONE;
-#ifdef CTL_TIME_IO
-		stats->flags |= CTL_STATS_FLAG_TIME_VALID;
-#endif
-		getnanouptime(&stats->timestamp);
-		break;
-	}
-#endif /* CTL_LEGACY_STATS */
 	case CTL_ERROR_INJECT: {
 		struct ctl_error_desc *err_desc, *new_err_desc;
 
@@ -4758,17 +4725,6 @@ fail:
 	ctl_init_log_page_index(lun);
 
 	/* Setup statistics gathering */
-#ifdef CTL_LEGACY_STATS
-	lun->legacy_stats.device_type = be_lun->lun_type;
-	lun->legacy_stats.lun_number = lun_number;
-	lun->legacy_stats.blocksize = be_lun->blocksize;
-	if (be_lun->blocksize == 0)
-		lun->legacy_stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE;
-	lun->legacy_stats.ports = malloc(sizeof(struct ctl_lun_io_port_stats) *
-	    ctl_max_ports, M_DEVBUF, M_WAITOK | M_ZERO);
-	for (len = 0; len < ctl_max_ports; len++)
-		lun->legacy_stats.ports[len].targ_port = len;
-#endif /* CTL_LEGACY_STATS */
 	lun->stats.item = lun_number;
 
 	/*
@@ -13078,21 +13034,6 @@ ctl_process_done(union ctl_io *io)
 			type = CTL_STATS_WRITE;
 		else
 			type = CTL_STATS_NO_IO;
-
-#ifdef CTL_LEGACY_STATS
-		uint32_t targ_port = port->targ_port;
-		lun->legacy_stats.ports[targ_port].bytes[type] +=
-		    io->scsiio.kern_total_len;
-		lun->legacy_stats.ports[targ_port].operations[type] ++;
-		lun->legacy_stats.ports[targ_port].num_dmas[type] +=
-		    io->io_hdr.num_dmas;
-#ifdef CTL_TIME_IO
-		bintime_add(&lun->legacy_stats.ports[targ_port].dma_time[type],
-		   &io->io_hdr.dma_bt);
-		bintime_add(&lun->legacy_stats.ports[targ_port].time[type],
-		    &bt);
-#endif
-#endif /* CTL_LEGACY_STATS */
 
 		lun->stats.bytes[type] += io->scsiio.kern_total_len;
 		lun->stats.operations[type] ++;

Modified: stable/12/sys/cam/ctl/ctl_ioctl.h
==============================================================================
--- stable/12/sys/cam/ctl/ctl_ioctl.h	Sat Mar  2 01:51:41 2019	(r344716)
+++ stable/12/sys/cam/ctl/ctl_ioctl.h	Sat Mar  2 03:17:23 2019	(r344717)
@@ -69,9 +69,6 @@
 /* Hopefully this won't conflict with new misc devices that pop up */
 #define	CTL_MINOR	225
 
-/* Legacy statistics accumulated for every port for every LU. */
-//#define CTL_LEGACY_STATS	1
-
 typedef enum {
 	CTL_DELAY_TYPE_NONE,
 	CTL_DELAY_TYPE_CONT,
@@ -119,39 +116,6 @@ typedef enum {
 	CTL_STATS_FLAG_TIME_VALID	= 0x01
 } ctl_stats_flags;
 
-#ifdef CTL_LEGACY_STATS
-typedef enum {
-	CTL_LUN_STATS_NO_BLOCKSIZE	= 0x01
-} ctl_lun_stats_flags;
-
-struct ctl_lun_io_port_stats {
-	uint32_t			targ_port;
-	uint64_t			bytes[CTL_STATS_NUM_TYPES];
-	uint64_t			operations[CTL_STATS_NUM_TYPES];
-	struct bintime			time[CTL_STATS_NUM_TYPES];
-	uint64_t			num_dmas[CTL_STATS_NUM_TYPES];
-	struct bintime			dma_time[CTL_STATS_NUM_TYPES];
-};
-
-struct ctl_lun_io_stats {
-	uint8_t				device_type;
-	uint64_t			lun_number;
-	uint32_t			blocksize;
-	ctl_lun_stats_flags		flags;
-	struct ctl_lun_io_port_stats	*ports;
-};
-
-struct ctl_stats {
-	int			alloc_len;	/* passed to kernel */
-	struct ctl_lun_io_stats	*lun_stats;	/* passed to/from kernel */
-	int			fill_len;	/* passed to userland */
-	int			num_luns;	/* passed to userland */
-	ctl_stats_status	status;		/* passed to userland */
-	ctl_stats_flags		flags;		/* passed to userland */
-	struct timespec		timestamp;	/* passed to userland */
-};
-#endif /* CTL_LEGACY_STATS */
-
 struct ctl_io_stats {
 	uint32_t			item;
 	uint64_t			bytes[CTL_STATS_NUM_TYPES];
@@ -795,7 +759,6 @@ struct ctl_lun_map {
 #define	CTL_ENABLE_PORT		_IOW(CTL_MINOR, 0x04, struct ctl_port_entry)
 #define	CTL_DISABLE_PORT	_IOW(CTL_MINOR, 0x05, struct ctl_port_entry)
 #define	CTL_DELAY_IO		_IOWR(CTL_MINOR, 0x10, struct ctl_io_delay_info)
-#define	CTL_GETSTATS		_IOWR(CTL_MINOR, 0x15, struct ctl_stats)
 #define	CTL_ERROR_INJECT	_IOWR(CTL_MINOR, 0x16, struct ctl_error_desc)
 #define	CTL_GET_OOA		_IOWR(CTL_MINOR, 0x18, struct ctl_ooa)
 #define	CTL_DUMP_STRUCTS	_IO(CTL_MINOR, 0x19)

Modified: stable/12/sys/cam/ctl/ctl_private.h
==============================================================================
--- stable/12/sys/cam/ctl/ctl_private.h	Sat Mar  2 01:51:41 2019	(r344716)
+++ stable/12/sys/cam/ctl/ctl_private.h	Sat Mar  2 03:17:23 2019	(r344717)
@@ -403,9 +403,6 @@ struct ctl_lun {
 	struct callout			ie_callout;	/* INTERVAL TIMER */
 	struct ctl_mode_pages		mode_pages;
 	struct ctl_log_pages		log_pages;
-#ifdef CTL_LEGACY_STATS
-	struct ctl_lun_io_stats		legacy_stats;
-#endif /* CTL_LEGACY_STATS */
 	struct ctl_io_stats		stats;
 	uint32_t			res_idx;
 	uint32_t			pr_generation;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903020317.x223HNOY058283>