Merge rf_update_component_labels() and rf_final_update_component_labels().
This commit is contained in:
parent
bd70b1984f
commit
0b63accce0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_driver.c,v 1.36 2000/05/29 01:43:04 oster Exp $ */
|
||||
/* $NetBSD: rf_driver.c,v 1.37 2000/06/04 02:05:13 oster Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -276,7 +276,7 @@ rf_Shutdown(raidPtr)
|
|||
|
||||
raidPtr->valid = 0;
|
||||
|
||||
rf_final_update_component_labels(raidPtr);
|
||||
rf_update_component_labels(raidPtr, RF_FINAL_COMPONENT_UPDATE);
|
||||
|
||||
rf_UnconfigureVnodes(raidPtr);
|
||||
|
||||
|
@ -722,7 +722,7 @@ rf_SetReconfiguredMode(raidPtr, row, col)
|
|||
raidPtr->numFailures++;
|
||||
raidPtr->Disks[row][col].status = rf_ds_dist_spared;
|
||||
raidPtr->status[row] = rf_rs_reconfigured;
|
||||
rf_update_component_labels(raidPtr);
|
||||
rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE);
|
||||
/* install spare table only if declustering + distributed sparing
|
||||
* architecture. */
|
||||
if (raidPtr->Layout.map->flags & RF_BD_DECLUSTERED)
|
||||
|
@ -746,7 +746,7 @@ rf_FailDisk(
|
|||
raidPtr->numFailures++;
|
||||
raidPtr->Disks[frow][fcol].status = rf_ds_failed;
|
||||
raidPtr->status[frow] = rf_rs_degraded;
|
||||
rf_update_component_labels(raidPtr);
|
||||
rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE);
|
||||
RF_UNLOCK_MUTEX(raidPtr->mutex);
|
||||
if (initRecon)
|
||||
rf_ReconstructFailedDisk(raidPtr, frow, fcol);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_kintf.h,v 1.13 2000/06/04 01:39:49 oster Exp $ */
|
||||
/* $NetBSD: rf_kintf.h,v 1.14 2000/06/04 02:05:13 oster Exp $ */
|
||||
/*
|
||||
* rf_kintf.h
|
||||
*
|
||||
|
@ -43,8 +43,10 @@ int rf_DispatchKernelIO(RF_DiskQueue_t * queue, RF_DiskQueueData_t * req);
|
|||
|
||||
int raidwrite_component_label(dev_t, struct vnode *, RF_ComponentLabel_t *);
|
||||
int raidread_component_label(dev_t, struct vnode *, RF_ComponentLabel_t *);
|
||||
void rf_update_component_labels( RF_Raid_t *);
|
||||
void rf_final_update_component_labels( RF_Raid_t *);
|
||||
|
||||
#define RF_NORMAL_COMPONENT_UPDATE 0
|
||||
#define RF_FINAL_COMPONENT_UPDATE 1
|
||||
void rf_update_component_labels(RF_Raid_t *, int);
|
||||
int raidlookup(char *, struct proc *, struct vnode **);
|
||||
int raidmarkclean(dev_t dev, struct vnode *b_vp, int);
|
||||
int raidmarkdirty(dev_t dev, struct vnode *b_vp, int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_netbsdkintf.c,v 1.90 2000/06/03 16:44:43 oster Exp $ */
|
||||
/* $NetBSD: rf_netbsdkintf.c,v 1.91 2000/06/04 02:05:13 oster Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -633,7 +633,8 @@ raidclose(dev, flags, fmt, p)
|
|||
#if 0
|
||||
printf("Last one on raid%d. Updating status.\n",unit);
|
||||
#endif
|
||||
rf_final_update_component_labels( raidPtrs[unit] );
|
||||
rf_update_component_labels(raidPtrs[unit],
|
||||
RF_FINAL_COMPONENT_UPDATE);
|
||||
}
|
||||
|
||||
raidunlock(rs);
|
||||
|
@ -1587,7 +1588,8 @@ raidstart(raidPtr)
|
|||
/* quick check to see if anything has died recently */
|
||||
RF_LOCK_MUTEX(raidPtr->mutex);
|
||||
if (raidPtr->numNewFailures > 0) {
|
||||
rf_update_component_labels(raidPtr);
|
||||
rf_update_component_labels(raidPtr,
|
||||
RF_NORMAL_COMPONENT_UPDATE);
|
||||
raidPtr->numNewFailures--;
|
||||
}
|
||||
RF_UNLOCK_MUTEX(raidPtr->mutex);
|
||||
|
@ -2327,8 +2329,9 @@ rf_markalldirty(raidPtr)
|
|||
|
||||
|
||||
void
|
||||
rf_update_component_labels(raidPtr)
|
||||
rf_update_component_labels(raidPtr, final)
|
||||
RF_Raid_t *raidPtr;
|
||||
int final;
|
||||
{
|
||||
RF_ComponentLabel_t clabel;
|
||||
int sparecol;
|
||||
|
@ -2360,6 +2363,14 @@ rf_update_component_labels(raidPtr)
|
|||
raidPtr->Disks[r][c].dev,
|
||||
raidPtr->raid_cinfo[r][c].ci_vp,
|
||||
&clabel);
|
||||
if (final == RF_FINAL_COMPONENT_UPDATE) {
|
||||
if (raidPtr->parity_good == RF_RAID_CLEAN) {
|
||||
raidmarkclean(
|
||||
raidPtr->Disks[r][c].dev,
|
||||
raidPtr->raid_cinfo[r][c].ci_vp,
|
||||
raidPtr->mod_counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* else we don't touch it.. */
|
||||
}
|
||||
|
@ -2408,104 +2419,12 @@ rf_update_component_labels(raidPtr)
|
|||
raidPtr->Disks[0][sparecol].dev,
|
||||
raidPtr->raid_cinfo[0][sparecol].ci_vp,
|
||||
&clabel);
|
||||
}
|
||||
}
|
||||
/* printf("Component labels updated\n"); */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rf_final_update_component_labels(raidPtr)
|
||||
RF_Raid_t *raidPtr;
|
||||
{
|
||||
RF_ComponentLabel_t clabel;
|
||||
int sparecol;
|
||||
int r,c;
|
||||
int i,j;
|
||||
int srow, scol;
|
||||
|
||||
srow = -1;
|
||||
scol = -1;
|
||||
|
||||
/* XXX should do extra checks to make sure things really are clean,
|
||||
rather than blindly setting the clean bit... */
|
||||
|
||||
raidPtr->mod_counter++;
|
||||
|
||||
for (r = 0; r < raidPtr->numRow; r++) {
|
||||
for (c = 0; c < raidPtr->numCol; c++) {
|
||||
if (raidPtr->Disks[r][c].status == rf_ds_optimal) {
|
||||
raidread_component_label(
|
||||
raidPtr->Disks[r][c].dev,
|
||||
raidPtr->raid_cinfo[r][c].ci_vp,
|
||||
&clabel);
|
||||
/* make sure status is noted */
|
||||
clabel.status = rf_ds_optimal;
|
||||
/* bump the counter */
|
||||
clabel.mod_counter = raidPtr->mod_counter;
|
||||
|
||||
raidwrite_component_label(
|
||||
raidPtr->Disks[r][c].dev,
|
||||
raidPtr->raid_cinfo[r][c].ci_vp,
|
||||
&clabel);
|
||||
if (final == RF_FINAL_COMPONENT_UPDATE) {
|
||||
if (raidPtr->parity_good == RF_RAID_CLEAN) {
|
||||
raidmarkclean(
|
||||
raidPtr->Disks[r][c].dev,
|
||||
raidPtr->raid_cinfo[r][c].ci_vp,
|
||||
raidPtr->mod_counter);
|
||||
raidmarkclean( raidPtr->Disks[0][sparecol].dev,
|
||||
raidPtr->raid_cinfo[0][sparecol].ci_vp,
|
||||
raidPtr->mod_counter);
|
||||
}
|
||||
}
|
||||
/* else we don't touch it.. */
|
||||
}
|
||||
}
|
||||
|
||||
for( c = 0; c < raidPtr->numSpare ; c++) {
|
||||
sparecol = raidPtr->numCol + c;
|
||||
if (raidPtr->Disks[0][sparecol].status == rf_ds_used_spare) {
|
||||
/*
|
||||
|
||||
we claim this disk is "optimal" if it's
|
||||
rf_ds_used_spare, as that means it should be
|
||||
directly substitutable for the disk it replaced.
|
||||
We note that too...
|
||||
|
||||
*/
|
||||
|
||||
for(i=0;i<raidPtr->numRow;i++) {
|
||||
for(j=0;j<raidPtr->numCol;j++) {
|
||||
if ((raidPtr->Disks[i][j].spareRow ==
|
||||
0) &&
|
||||
(raidPtr->Disks[i][j].spareCol ==
|
||||
sparecol)) {
|
||||
srow = i;
|
||||
scol = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX shouldn't *really* need this... */
|
||||
raidread_component_label(
|
||||
raidPtr->Disks[0][sparecol].dev,
|
||||
raidPtr->raid_cinfo[0][sparecol].ci_vp,
|
||||
&clabel);
|
||||
/* make sure status is noted */
|
||||
|
||||
raid_init_component_label(raidPtr, &clabel);
|
||||
|
||||
clabel.mod_counter = raidPtr->mod_counter;
|
||||
clabel.row = srow;
|
||||
clabel.column = scol;
|
||||
clabel.status = rf_ds_optimal;
|
||||
|
||||
raidwrite_component_label(
|
||||
raidPtr->Disks[0][sparecol].dev,
|
||||
raidPtr->raid_cinfo[0][sparecol].ci_vp,
|
||||
&clabel);
|
||||
if (raidPtr->parity_good == RF_RAID_CLEAN) {
|
||||
raidmarkclean( raidPtr->Disks[0][sparecol].dev,
|
||||
raidPtr->raid_cinfo[0][sparecol].ci_vp,
|
||||
raidPtr->mod_counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_reconstruct.c,v 1.25 2000/05/31 00:52:36 oster Exp $ */
|
||||
/* $NetBSD: rf_reconstruct.c,v 1.26 2000/06/04 02:05:13 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -435,7 +435,8 @@ rf_ReconstructInPlace(raidPtr, row, col)
|
|||
raidPtr->numFailures++;
|
||||
raidPtr->Disks[row][col].status = rf_ds_failed;
|
||||
raidPtr->status[row] = rf_rs_degraded;
|
||||
rf_update_component_labels(raidPtr);
|
||||
rf_update_component_labels(raidPtr,
|
||||
RF_NORMAL_COMPONENT_UPDATE);
|
||||
}
|
||||
|
||||
while (raidPtr->reconInProgress) {
|
||||
|
|
Loading…
Reference in New Issue