示例#1
0
void
rf_ContinueDagAccess(RF_DagList_t *dagList)
{
#if RF_ACC_TRACE > 0
	RF_AccTraceEntry_t *tracerec = &(dagList->desc->tracerec);
	RF_Etimer_t timer;
#endif
	RF_RaidAccessDesc_t *desc;
	RF_DagHeader_t *dag_h;
	int     i;

	desc = dagList->desc;

#if RF_ACC_TRACE > 0
	timer = tracerec->timer;
	RF_ETIMER_STOP(timer);
	RF_ETIMER_EVAL(timer);
	tracerec->specific.user.exec_us = RF_ETIMER_VAL_US(timer);
	RF_ETIMER_START(tracerec->timer);
#endif

	/* skip to dag which just finished */
	dag_h = dagList->dags;
	for (i = 0; i < dagList->numDagsDone; i++) {
		dag_h = dag_h->next;
	}

	/* check to see if retry is required */
	if (dag_h->status == rf_rollBackward) {
		/* when a dag fails, mark desc status as bad and allow
		 * all other dags in the desc to execute to
		 * completion.  then, free all dags and start over */
		desc->status = 1;	/* bad status */
#if 0
		printf("raid%d: DAG failure: %c addr 0x%lx "
		       "(%ld) nblk 0x%x (%d) buf 0x%lx state %d\n",
		       desc->raidPtr->raidid, desc->type,
		       (long) desc->raidAddress,
		       (long) desc->raidAddress, (int) desc->numBlocks,
		       (int) desc->numBlocks,
		       (unsigned long) (desc->bufPtr), desc->state);
#endif
	}
	dagList->numDagsDone++;
	rf_ContinueRaidAccess(desc);
}
示例#2
0
/*********************************************************************
 * Main routine for performing an access.
 * Accesses are retried until a DAG can not be selected.  This occurs
 * when either the DAG library is incomplete or there are too many
 * failures in a parity group.
 *
 * type should be read or write async_flag should be RF_TRUE or
 * RF_FALSE bp_in is a buf pointer.  void *to facilitate ignoring it
 * outside the kernel
 ********************************************************************/
int
rf_DoAccess(RF_Raid_t * raidPtr, RF_IoType_t type, int async_flag,
	    RF_RaidAddr_t raidAddress, RF_SectorCount_t numBlocks,
	    void *bufPtr, struct buf *bp, RF_RaidAccessFlags_t flags)
{
	RF_RaidAccessDesc_t *desc;
	void *lbufPtr = bufPtr;

	raidAddress += rf_raidSectorOffset;

#if RF_ACCESS_DEBUG
	if (rf_accessDebug) {

		printf("logBytes is: %d %d %d\n", raidPtr->raidid,
		    raidPtr->logBytesPerSector,
		    (int) rf_RaidAddressToByte(raidPtr, numBlocks));
		printf("raid%d: %s raidAddr %d (stripeid %d-%d) numBlocks %d (%d bytes) buf 0x%lx\n", raidPtr->raidid,
		    (type == RF_IO_TYPE_READ) ? "READ" : "WRITE", (int) raidAddress,
		    (int) rf_RaidAddressToStripeID(&raidPtr->Layout, raidAddress),
		    (int) rf_RaidAddressToStripeID(&raidPtr->Layout, raidAddress + numBlocks - 1),
		    (int) numBlocks,
		    (int) rf_RaidAddressToByte(raidPtr, numBlocks),
		    (long) bufPtr);
	}
#endif

	desc = rf_AllocRaidAccDesc(raidPtr, type, raidAddress,
	    numBlocks, lbufPtr, bp, flags, raidPtr->Layout.map->states);

	if (desc == NULL) {
		return (ENOMEM);
	}
#if RF_ACC_TRACE > 0
	RF_ETIMER_START(desc->tracerec.tot_timer);
#endif
	desc->async_flag = async_flag;

	if (raidPtr->parity_map != NULL && 
	    type == RF_IO_TYPE_WRITE)
		rf_paritymap_begin(raidPtr->parity_map, raidAddress, 
		    numBlocks);

	rf_ContinueRaidAccess(desc);

	return (0);
}
示例#3
0
void
rf_ContinueDagAccess(RF_DagList_t *dagList)
{
	RF_AccTraceEntry_t *tracerec = &(dagList->desc->tracerec);
	RF_RaidAccessDesc_t *desc;
	RF_DagHeader_t *dag_h;
	RF_Etimer_t timer;
	int i;

	desc = dagList->desc;

	timer = tracerec->timer;
	RF_ETIMER_STOP(timer);
	RF_ETIMER_EVAL(timer);
	tracerec->specific.user.exec_us = RF_ETIMER_VAL_US(timer);
	RF_ETIMER_START(tracerec->timer);

	/* Skip to dag which just finished. */
	dag_h = dagList->dags;
	for (i = 0; i < dagList->numDagsDone; i++) {
		dag_h = dag_h->next;
	}

	/* Check to see if retry is required. */
	if (dag_h->status == rf_rollBackward) {
		/*
		 * When a dag fails, mark desc status as bad and allow all
		 * other dags in the desc to execute to completion. Then,
		 * free all dags and start over.
		 */
		desc->status = 1;	/* Bad status. */
		{
			printf("raid%d: DAG failure: %c addr 0x%lx (%ld)"
			       " nblk 0x%x (%d) buf 0x%lx.\n",
			       desc->raidPtr->raidid, desc->type,
			       (long) desc->raidAddress,
			       (long) desc->raidAddress,
			       (int) desc->numBlocks, (int) desc->numBlocks,
			       (unsigned long) (desc->bufPtr));
		}
	}
	dagList->numDagsDone++;
	rf_ContinueRaidAccess(desc);
}