diff usr/src/uts/sun4v/sys/vdc.h @ 10971:2663784ac9bb

backout 6726533: causes 6898072
author jmcp <James.McPherson@Sun.COM>
date Thu, 05 Nov 2009 15:54:24 -0800
parents c6175c150216
children 4bcbed8266fd
line wrap: on
line diff
--- a/usr/src/uts/sun4v/sys/vdc.h	Thu Nov 05 15:51:00 2009 -0800
+++ b/usr/src/uts/sun4v/sys/vdc.h	Thu Nov 05 15:54:24 2009 -0800
@@ -84,16 +84,6 @@
 #define	VDC_SEQ_NUM_TODO		1	/* Request needs processing */
 
 /*
- * Flags for virtual disk operations.
- */
-#define	VDC_OP_STATE_RUNNING	0x01	/* do operation in running state */
-#define	VDC_OP_ERRCHK_BACKEND	0x02	/* check backend on error */
-#define	VDC_OP_ERRCHK_CONFLICT	0x04	/* check resv conflict on error */
-
-#define	VDC_OP_ERRCHK	(VDC_OP_ERRCHK_BACKEND | VDC_OP_ERRCHK_CONFLICT)
-#define	VDC_OP_NORMAL	(VDC_OP_STATE_RUNNING | VDC_OP_ERRCHK)
-
-/*
  * Macros to get UNIT and PART number
  */
 #define	VDCUNIT_SHIFT	3
@@ -181,26 +171,12 @@
 	VDC_STATE_INIT_WAITING,		/* waiting for ldc connection */
 	VDC_STATE_NEGOTIATE,		/* doing handshake negotiation */
 	VDC_STATE_HANDLE_PENDING,	/* handle requests in backup dring */
-	VDC_STATE_FAULTED,		/* multipath backend is inaccessible */
-	VDC_STATE_FAILED,		/* device is not usable */
 	VDC_STATE_RUNNING,		/* running and accepting requests */
 	VDC_STATE_DETACH,		/* detaching */
 	VDC_STATE_RESETTING		/* resetting connection with vds */
 } vdc_state_t;
 
 /*
- * States of the service provided by a vds server
- */
-typedef enum vdc_service_state {
-	VDC_SERVICE_NONE = -1, 		/* no state define */
-	VDC_SERVICE_OFFLINE,		/* no connection with the service */
-	VDC_SERVICE_CONNECTED,		/* connection established */
-	VDC_SERVICE_ONLINE,		/* connection and backend available */
-	VDC_SERVICE_FAILED,		/* connection failed */
-	VDC_SERVICE_FAULTED		/* connection but backend unavailable */
-} vdc_service_state_t;
-
-/*
  * The states that the vdc instance can be in.
  */
 typedef enum vdc_lc_state {
@@ -222,6 +198,11 @@
 	VIO_both_dir		/* transfer both in and out in same buffer */
 } vio_desc_direction_t;
 
+typedef enum {
+	CB_STRATEGY,		/* non-blocking strategy call */
+	CB_SYNC			/* synchronous operation */
+} vio_cb_type_t;
+
 typedef struct vdc_local_desc {
 	boolean_t		is_free;	/* local state - inuse or not */
 
@@ -230,9 +211,9 @@
 	int			slice;
 	diskaddr_t		offset;		/* disk offset */
 	size_t			nbytes;
-	struct buf		*buf;		/* buf of operation */
+	vio_cb_type_t		cb_type;	/* operation type blk/nonblk */
+	void			*cb_arg;	/* buf passed to strategy() */
 	vio_desc_direction_t	dir;		/* direction of transfer */
-	int			flags;		/* flags of operation */
 
 	caddr_t			align_addr;	/* used if addr non-aligned */
 	ldc_mem_handle_t	desc_mhdl;	/* Mem handle of buf */
@@ -241,11 +222,11 @@
 } vdc_local_desc_t;
 
 /*
- * I/O queue used for checking backend or failfast
+ * I/O queue used by failfast
  */
 typedef struct vdc_io {
 	struct vdc_io	*vio_next;	/* next pending I/O in the queue */
-	int		vio_index;	/* descriptor index */
+	struct buf	*vio_buf;	/* buf for CB_STRATEGY I/O */
 	clock_t		vio_qtime;	/* time the I/O was queued */
 } vdc_io_t;
 
@@ -265,8 +246,6 @@
 	struct vdc		*vdcp;			/* Ptr to vdc struct */
 	uint64_t		id;			/* Server port id */
 	uint64_t		state;			/* Server state */
-	vdc_service_state_t	svc_state;		/* Service state */
-	vdc_service_state_t	log_state;		/* Last state logged */
 	uint64_t		ldc_id;			/* Server LDC id */
 	ldc_handle_t		ldc_handle;		/* Server LDC handle */
 	ldc_status_t		ldc_state;		/* Server LDC state */
@@ -283,9 +262,7 @@
 	kcondvar_t	initwait_cv;	/* signal when ldc conn is up */
 	kcondvar_t	dring_free_cv;	/* signal when desc is avail */
 	kcondvar_t	membind_cv;	/* signal when mem can be bound */
-	boolean_t	self_reset;	/* self initiated reset */
-	kcondvar_t	io_pending_cv;	/* signal on pending I/O */
-	boolean_t	io_pending;	/* pending I/O */
+	boolean_t	self_reset;
 
 	int		initialized;	/* keeps track of what's init'ed */
 	vdc_lc_state_t	lifecycle;	/* Current state of the vdc instance */
@@ -308,7 +285,10 @@
 	vdc_rd_state_t	read_state;	/* current read state */
 
 	uint32_t	sync_op_cnt;	/* num of active sync operations */
+	boolean_t	sync_op_pending; /* sync operation is pending */
 	boolean_t	sync_op_blocked; /* blocked waiting to do sync op */
+	uint32_t	sync_op_status;	/* status of sync operation */
+	kcondvar_t	sync_pending_cv; /* cv wait for sync op to finish */
 	kcondvar_t	sync_blocked_cv; /* cv wait for other syncs to finish */
 
 	uint64_t	session_id;	/* common ID sent with all messages */
@@ -346,12 +326,13 @@
 	kcondvar_t	ownership_cv;		/* cv for ownership update */
 
 	/*
-	 * The eio and failfast fields are protected by the lock mutex.
+	 * The failfast fields are protected by the lock mutex.
 	 */
-	kthread_t	*eio_thread;		/* error io thread */
-	kcondvar_t	eio_cv;			/* cv for eio thread update */
-	vdc_io_t	*eio_queue;		/* error io queue */
+	kthread_t	*failfast_thread;	/* failfast thread */
 	clock_t		failfast_interval;	/* interval in microsecs */
+	kcondvar_t	failfast_cv;		/* cv for failfast update */
+	kcondvar_t	failfast_io_cv;		/* cv wait for I/O to finish */
+	vdc_io_t	*failfast_io_queue;	/* failfast io queue */
 
 	/*
 	 * kstats used to store I/O statistics consumed by iostat(1M).