if (raidPtr->parity_good == RF_RAID_DIRTY) {  usemirror = 0; } else
rf_SelectMirrorDiskIdle(RF_DagNode_t * node){	RF_Raid_t *raidPtr = (RF_Raid_t *) node->dagHdr->raidPtr;	RF_RowCol_t rowData, colData, rowMirror, colMirror;	int     dataQueueLength, mirrorQueueLength, usemirror;	RF_PhysDiskAddr_t *data_pda = (RF_PhysDiskAddr_t *) node->params[0].p;	RF_PhysDiskAddr_t *mirror_pda = (RF_PhysDiskAddr_t *) node->params[4].p;	RF_PhysDiskAddr_t *tmp_pda;	RF_RaidDisk_t **disks = raidPtr->Disks;	RF_DiskQueue_t **dqs = raidPtr->Queues, *dataQueue, *mirrorQueue;	/* return the [row col] of the disk with the shortest queue */	rowData = data_pda->row;	colData = data_pda->col;	rowMirror = mirror_pda->row;	colMirror = mirror_pda->col;	dataQueue = &(dqs[rowData][colData]);	mirrorQueue = &(dqs[rowMirror][colMirror]);#ifdef RF_LOCK_QUEUES_TO_READ_LEN	RF_LOCK_QUEUE_MUTEX(dataQueue, "SelectMirrorDiskIdle");#endif				/* RF_LOCK_QUEUES_TO_READ_LEN */	dataQueueLength = dataQueue->queueLength + dataQueue->numOutstanding;#ifdef RF_LOCK_QUEUES_TO_READ_LEN	RF_UNLOCK_QUEUE_MUTEX(dataQueue, "SelectMirrorDiskIdle");	RF_LOCK_QUEUE_MUTEX(mirrorQueue, "SelectMirrorDiskIdle");#endif				/* RF_LOCK_QUEUES_TO_READ_LEN */	mirrorQueueLength = mirrorQueue->queueLength + mirrorQueue->numOutstanding;#ifdef RF_LOCK_QUEUES_TO_READ_LEN	RF_UNLOCK_QUEUE_MUTEX(mirrorQueue, "SelectMirrorDiskIdle");#endif				/* RF_LOCK_QUEUES_TO_READ_LEN */	usemirror = 0;	if (RF_DEAD_DISK(disks[rowMirror][colMirror].status)) {		usemirror = 0;	} else		if (RF_DEAD_DISK(disks[rowData][colData].status)) {			usemirror = 1;		} else			if (dataQueueLength < mirrorQueueLength) {				usemirror = 0;			} else				if (mirrorQueueLength < dataQueueLength) {					usemirror = 1;				} else {					/* queues are equal length. attempt					 * cleverness. */					if (SNUM_DIFF(dataQueue->last_deq_sector, data_pda->startSector)					    <= SNUM_DIFF(mirrorQueue->last_deq_sector, mirror_pda->startSector)) {						usemirror = 0;					} else {						usemirror = 1;					}				}	if (usemirror) {		/* use mirror (parity) disk, swap params 0 & 4 */		tmp_pda = data_pda;		node->params[0].p = mirror_pda;		node->params[4].p = tmp_pda;	} else {		/* use data disk, leave param 0 unchanged */	}	/* printf("dataQueueLength %d, mirrorQueueLength	 * %d\n",dataQueueLength, mirrorQueueLength); */}