diff options
| author | oster <oster@NetBSD.org> | 2000-03-07 02:59:50 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 2000-03-07 02:59:50 +0000 |
| commit | 51ffb0924c74f97084d2614c89e3bb6df7ca0121 (patch) | |
| tree | c8f1c7d73bddca633c870892d6aae7de99674208 /sys/dev/raidframe | |
| parent | ddebc1cad0c13f5287f6953dc2da498c7f966899 (diff) | |
Create a new rf_close_component() to handle vnode operations for closing
components. Teach rf_UnconfigureVnodes() how to use it, and tell
the copyback and reconstruction code about it too.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_copyback.c | 16 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_kintf.h | 4 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 74 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_reconstruct.c | 16 |
4 files changed, 51 insertions, 59 deletions
diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c index 04c864ebe6b..0f7e562e0e1 100644 --- a/sys/dev/raidframe/rf_copyback.c +++ b/sys/dev/raidframe/rf_copyback.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_copyback.c,v 1.13 2000/02/23 02:03:03 oster Exp $ */ +/* $NetBSD: rf_copyback.c,v 1.14 2000/03/07 02:59:50 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -98,6 +98,8 @@ rf_CopybackReconstructedData(raidPtr) struct vattr va; struct proc *proc; + int ac; + done = 0; fcol = 0; for (frow = 0; frow < raidPtr->numRow; frow++) { @@ -126,15 +128,9 @@ rf_CopybackReconstructedData(raidPtr) if (raidPtr->raid_cinfo[frow][fcol].ci_vp != NULL) { printf("Closed the open device: %s\n", raidPtr->Disks[frow][fcol].devname); - if (raidPtr->Disks[frow][fcol].auto_configured == 1) { - VOP_CLOSE(raidPtr->raid_cinfo[frow][fcol].ci_vp, - FREAD, NOCRED, 0); - vput(raidPtr->raid_cinfo[frow][fcol].ci_vp); - } else { - VOP_UNLOCK(raidPtr->raid_cinfo[frow][fcol].ci_vp, 0); - (void) vn_close(raidPtr->raid_cinfo[frow][fcol].ci_vp, - FREAD | FWRITE, proc->p_ucred, proc); - } + vp = raidPtr->raid_cinfo[frow][fcol].ci_vp; + ac = raidPtr->Disks[frow][fcol].auto_configured; + rf_close_component(raidPtr, vp, ac); raidPtr->raid_cinfo[frow][fcol].ci_vp = NULL; } diff --git a/sys/dev/raidframe/rf_kintf.h b/sys/dev/raidframe/rf_kintf.h index 09f7ed6d717..8e0ae0cc672 100644 --- a/sys/dev/raidframe/rf_kintf.h +++ b/sys/dev/raidframe/rf_kintf.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_kintf.h,v 1.11 2000/03/07 02:28:05 oster Exp $ */ +/* $NetBSD: rf_kintf.h,v 1.12 2000/03/07 02:59:50 oster Exp $ */ /* * rf_kintf.h * @@ -51,5 +51,5 @@ int raidmarkdirty(dev_t dev, struct vnode *b_vp, int); void raid_init_component_label __P((RF_Raid_t *, RF_ComponentLabel_t *)); void rf_print_component_label __P((RF_ComponentLabel_t *)); void rf_UnconfigureVnodes( RF_Raid_t * ); - +void rf_close_component( RF_Raid_t *, struct vnode *, int); #endif /* _RF__RF_KINTF_H_ */ diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 9b2fd58c9fd..9171cd641a5 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.68 2000/03/07 02:28:05 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.69 2000/03/07 02:59:50 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -2433,11 +2433,38 @@ rf_final_update_component_labels( raidPtr ) } void +rf_close_component( raidPtr, vp, auto_configured ) + RF_Raid_t *raidPtr; + struct vnode *vp; + int auto_configured; +{ + struct proc *p; + + p = raidPtr->engine_thread; + + if (vp != NULL) { + if (auto_configured == 1) { + VOP_CLOSE(vp, FREAD, NOCRED, 0); + vput(vp); + + } else { + VOP_UNLOCK(vp, 0); + (void) vn_close(vp, FREAD | FWRITE, p->p_ucred, p); + } + } else { + printf("vnode was NULL\n"); + } +} + + +void rf_UnconfigureVnodes( raidPtr ) RF_Raid_t *raidPtr; { int r,c; struct proc *p; + struct vnode *vp; + int acd; /* We take this opportunity to close the vnodes like we should.. */ @@ -2447,46 +2474,21 @@ rf_UnconfigureVnodes( raidPtr ) for (r = 0; r < raidPtr->numRow; r++) { for (c = 0; c < raidPtr->numCol; c++) { printf("Closing vnode for row: %d col: %d\n", r, c); - if (raidPtr->raid_cinfo[r][c].ci_vp != NULL) { - if (raidPtr->Disks[r][c].auto_configured == 1) { - VOP_CLOSE(raidPtr->raid_cinfo[r][c].ci_vp, - FREAD, NOCRED, 0); - vput(raidPtr->raid_cinfo[r][c].ci_vp); - - } else { - VOP_UNLOCK(raidPtr->raid_cinfo[r][c].ci_vp, 0); - (void) vn_close(raidPtr->raid_cinfo[r][c].ci_vp, - FREAD | FWRITE, p->p_ucred, p); - } - raidPtr->raid_cinfo[r][c].ci_vp = NULL; - raidPtr->Disks[r][c].auto_configured = 0; - } else { - printf("vnode was NULL\n"); - } - + vp = raidPtr->raid_cinfo[r][c].ci_vp; + acd = raidPtr->Disks[r][c].auto_configured; + rf_close_component(raidPtr, vp, acd); + raidPtr->raid_cinfo[r][c].ci_vp = NULL; + raidPtr->Disks[r][c].auto_configured = 0; } } for (r = 0; r < raidPtr->numSpare; r++) { printf("Closing vnode for spare: %d\n", r); - if (raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp) { - if (raidPtr->Disks[0][raidPtr->numCol + r].auto_configured == 1) { - VOP_CLOSE(raidPtr->raid_cinfo[0][raidPtr->numCol +r].ci_vp, - FREAD, NOCRED, 0); - vput(raidPtr->raid_cinfo[0][raidPtr->numCol +r].ci_vp); - - } else { - VOP_UNLOCK(raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp, 0); - (void) vn_close(raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp, - FREAD | FWRITE, p->p_ucred, p); - } - raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp = NULL; - raidPtr->Disks[0][raidPtr->numCol + r].auto_configured = 0; - } else { - printf("vnode was NULL\n"); - } + vp = raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp; + acd = raidPtr->Disks[0][raidPtr->numCol + r].auto_configured; + rf_close_component(raidPtr, vp, acd); + raidPtr->raid_cinfo[0][raidPtr->numCol + r].ci_vp = NULL; + raidPtr->Disks[0][raidPtr->numCol + r].auto_configured = 0; } - - } diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index 9027747378f..9172941a0e3 100644 --- a/sys/dev/raidframe/rf_reconstruct.c +++ b/sys/dev/raidframe/rf_reconstruct.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconstruct.c,v 1.20 2000/02/25 17:14:18 oster Exp $ */ +/* $NetBSD: rf_reconstruct.c,v 1.21 2000/03/07 02:59:50 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -400,6 +400,7 @@ rf_ReconstructInPlace(raidPtr, row, col) struct vattr va; struct proc *proc; int retcode; + int ac; lp = raidPtr->Layout.map; if (lp->SubmitReconBuffer) { @@ -477,16 +478,9 @@ rf_ReconstructInPlace(raidPtr, row, col) if (raidPtr->raid_cinfo[row][col].ci_vp != NULL) { printf("Closed the open device: %s\n", raidPtr->Disks[row][col].devname); - if (raidPtr->Disks[row][col].auto_configured == 1) { - VOP_CLOSE(raidPtr->raid_cinfo[row][col].ci_vp, - FREAD, NOCRED, 0); - vput(raidPtr->raid_cinfo[row][col].ci_vp); - - } else { - VOP_UNLOCK(raidPtr->raid_cinfo[row][col].ci_vp, 0); - (void) vn_close(raidPtr->raid_cinfo[row][col].ci_vp, - FREAD | FWRITE, proc->p_ucred, proc); - } + vp = raidPtr->raid_cinfo[row][col].ci_vp; + ac = raidPtr->Disks[row][col].auto_configured; + rf_close_component(raidPtr, vp, ac); raidPtr->raid_cinfo[row][col].ci_vp = NULL; } /* note that this disk was *not* auto_configured (any longer)*/ |
