Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe Get recent changes into the tree:
details: https://anonhg.NetBSD.org/src/rev/c3e7b2ab025f
branches: trunk
changeset: 482070:c3e7b2ab025f
user: oster <oster%NetBSD.org@localhost>
date: Sun Feb 13 04:53:57 2000 +0000
description:
Get recent changes into the tree:
- make component_label variables more consistent (==> clabel)
- re-work incorrect component configuration code
- re-work disk configuration code
- cleanup initial configuration of raidPtr info
- add auto-detection of components and RAID sets (Disabled, for now)
- allow / on RAID sets (Disabled, for now)
- rename "config_disk_queue" to "rf_ConfigureDiskQueue" and properly prototype
in rf_diskqueue.h
- protect some headers with #if _KERNEL (XXX this needs to be fixed properly)
and cleanup header formatting.
- expand the component labels (yes, they should be backward/forward compatible)
- other bits and pieces (some function names are still bogus, and will get
changed soon)
diffstat:
sys/dev/raidframe/rf_diskqueue.c | 44 +-
sys/dev/raidframe/rf_diskqueue.h | 45 +-
sys/dev/raidframe/rf_disks.c | 193 +++++++-
sys/dev/raidframe/rf_disks.h | 20 +-
sys/dev/raidframe/rf_driver.c | 45 +-
sys/dev/raidframe/rf_driver.h | 69 +-
sys/dev/raidframe/rf_kintf.h | 3 +-
sys/dev/raidframe/rf_netbsd.h | 45 +-
sys/dev/raidframe/rf_netbsdkintf.c | 867 ++++++++++++++++++++++++++++++++----
sys/dev/raidframe/rf_raid.h | 5 +-
sys/dev/raidframe/rf_raidframe.h | 4 +-
sys/dev/raidframe/rf_reconstruct.c | 10 +-
12 files changed, 1111 insertions(+), 239 deletions(-)
diffs (truncated from 1969 to 300 lines):
diff -r e5d7182f5407 -r c3e7b2ab025f sys/dev/raidframe/rf_diskqueue.c
--- a/sys/dev/raidframe/rf_diskqueue.c Sun Feb 13 04:28:09 2000 +0000
+++ b/sys/dev/raidframe/rf_diskqueue.c Sun Feb 13 04:53:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_diskqueue.c,v 1.8 2000/01/07 03:43:39 oster Exp $ */
+/* $NetBSD: rf_diskqueue.c,v 1.9 2000/02/13 04:53:57 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -164,7 +164,8 @@
{
/* XXX not sure if the following malloc is appropriate... probably not
* quite... */
- dqd->bp = (struct buf *) malloc(sizeof(struct buf), M_RAIDFRAME, M_NOWAIT);
+ dqd->bp = (struct buf *) malloc(sizeof(struct buf),
+ M_RAIDFRAME, M_NOWAIT);
if (dqd->bp == NULL) {
return (ENOMEM);
}
@@ -180,24 +181,20 @@
free(dqd->bp, M_RAIDFRAME);
}
/* configures a single disk queue */
-int config_disk_queue(RF_Raid_t *, RF_DiskQueue_t *, RF_RowCol_t,
- RF_RowCol_t, RF_DiskQueueSW_t *,
- RF_SectorCount_t, dev_t, int,
- RF_ShutdownList_t **,
- RF_AllocListElem_t *);
+
int
-config_disk_queue(
- RF_Raid_t * raidPtr,
- RF_DiskQueue_t * diskqueue,
- RF_RowCol_t r, /* row & col -- debug only. BZZT not any
+rf_ConfigureDiskQueue(
+ RF_Raid_t * raidPtr,
+ RF_DiskQueue_t * diskqueue,
+ RF_RowCol_t r, /* row & col -- debug only. BZZT not any
* more... */
- RF_RowCol_t c,
- RF_DiskQueueSW_t * p,
- RF_SectorCount_t sectPerDisk,
- dev_t dev,
- int maxOutstanding,
- RF_ShutdownList_t ** listp,
- RF_AllocListElem_t * clList)
+ RF_RowCol_t c,
+ RF_DiskQueueSW_t * p,
+ RF_SectorCount_t sectPerDisk,
+ dev_t dev,
+ int maxOutstanding,
+ RF_ShutdownList_t ** listp,
+ RF_AllocListElem_t * clList)
{
int rc;
@@ -296,9 +293,12 @@
if (diskQueues[r] == NULL)
return (ENOMEM);
for (c = 0; c < raidPtr->numCol; c++) {
- rc = config_disk_queue(raidPtr, &diskQueues[r][c], r, c, p,
- raidPtr->sectorsPerDisk, raidPtr->Disks[r][c].dev,
- cfgPtr->maxOutstandingDiskReqs, listp, raidPtr->cleanupList);
+ rc = rf_ConfigureDiskQueue(raidPtr, &diskQueues[r][c],
+ r, c, p,
+ raidPtr->sectorsPerDisk,
+ raidPtr->Disks[r][c].dev,
+ cfgPtr->maxOutstandingDiskReqs,
+ listp, raidPtr->cleanupList);
if (rc)
return (rc);
}
@@ -306,7 +306,7 @@
spareQueues = &raidPtr->Queues[0][raidPtr->numCol];
for (r = 0; r < raidPtr->numSpare; r++) {
- rc = config_disk_queue(raidPtr, &spareQueues[r],
+ rc = rf_ConfigureDiskQueue(raidPtr, &spareQueues[r],
0, raidPtr->numCol + r, p,
raidPtr->sectorsPerDisk,
raidPtr->Disks[0][raidPtr->numCol + r].dev,
diff -r e5d7182f5407 -r c3e7b2ab025f sys/dev/raidframe/rf_diskqueue.h
--- a/sys/dev/raidframe/rf_diskqueue.h Sun Feb 13 04:28:09 2000 +0000
+++ b/sys/dev/raidframe/rf_diskqueue.h Sun Feb 13 04:53:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_diskqueue.h,v 1.4 2000/01/08 23:02:16 oster Exp $ */
+/* $NetBSD: rf_diskqueue.h,v 1.5 2000/02/13 04:53:57 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -173,21 +173,36 @@
RF_ReconUnitNum_t which_ru);
RF_DiskQueueData_t *
-rf_CreateDiskQueueData(RF_IoType_t typ,
- RF_SectorNum_t ssect, RF_SectorCount_t nsect, caddr_t buf,
- RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru,
- int (*wakeF) (void *, int),
- void *arg, RF_DiskQueueData_t * next, RF_AccTraceEntry_t * tracerec,
- void *raidPtr, RF_DiskQueueDataFlags_t flags, void *kb_proc);
+rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
+ RF_SectorCount_t nsect, caddr_t buf,
+ RF_StripeNum_t parityStripeID,
+ RF_ReconUnitNum_t which_ru,
+ int (*wakeF) (void *, int),
+ void *arg, RF_DiskQueueData_t * next,
+ RF_AccTraceEntry_t * tracerec,
+ void *raidPtr, RF_DiskQueueDataFlags_t flags,
+ void *kb_proc);
- RF_DiskQueueData_t *rf_CreateDiskQueueDataFull(RF_IoType_t typ,
- RF_SectorNum_t ssect, RF_SectorCount_t nsect, caddr_t buf,
- RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru,
- int (*wakeF) (void *, int),
- void *arg, RF_DiskQueueData_t * next, RF_AccTraceEntry_t * tracerec,
- int priority, int (*AuxFunc) (void *,...), caddr_t buf2,
- void *raidPtr, RF_DiskQueueDataFlags_t flags, void *kb_proc);
+RF_DiskQueueData_t *
+rf_CreateDiskQueueDataFull(RF_IoType_t typ, RF_SectorNum_t ssect,
+ RF_SectorCount_t nsect, caddr_t buf,
+ RF_StripeNum_t parityStripeID,
+ RF_ReconUnitNum_t which_ru,
+ int (*wakeF) (void *, int),
+ void *arg, RF_DiskQueueData_t * next,
+ RF_AccTraceEntry_t * tracerec,
+ int priority, int (*AuxFunc) (void *,...),
+ caddr_t buf2, void *raidPtr,
+ RF_DiskQueueDataFlags_t flags, void *kb_proc);
- void rf_FreeDiskQueueData(RF_DiskQueueData_t * p);
+void
+rf_FreeDiskQueueData(RF_DiskQueueData_t * p);
+
+int
+rf_ConfigureDiskQueue(RF_Raid_t *, RF_DiskQueue_t *, RF_RowCol_t,
+ RF_RowCol_t, RF_DiskQueueSW_t *,
+ RF_SectorCount_t, dev_t, int,
+ RF_ShutdownList_t **,
+ RF_AllocListElem_t *);
#endif /* !_RF__RF_DISKQUEUE_H_ */
diff -r e5d7182f5407 -r c3e7b2ab025f sys/dev/raidframe/rf_disks.c
--- a/sys/dev/raidframe/rf_disks.c Sun Feb 13 04:28:09 2000 +0000
+++ b/sys/dev/raidframe/rf_disks.c Sun Feb 13 04:53:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_disks.c,v 1.14 2000/01/09 01:29:28 oster Exp $ */
+/* $NetBSD: rf_disks.c,v 1.15 2000/02/13 04:53:57 oster Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -74,6 +74,7 @@
#include "rf_general.h"
#include "rf_options.h"
#include "rf_kintf.h"
+#include "rf_netbsd.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -86,6 +87,7 @@
/* XXX these should be in a header file somewhere */
void rf_UnconfigureVnodes( RF_Raid_t * );
int rf_CheckLabels( RF_Raid_t *, RF_Config_t *);
+static int rf_AllocDiskStructures(RF_Raid_t *, RF_Config_t *);
#define DPRINTF6(a,b,c,d,e,f) if (rf_diskDebug) printf(a,b,c,d,e,f)
#define DPRINTF7(a,b,c,d,e,f,g) if (rf_diskDebug) printf(a,b,c,d,e,f,g)
@@ -115,11 +117,8 @@
RF_RowCol_t r, c;
int bs, ret;
unsigned i, count, foundone = 0, numFailuresThisRow;
- int num_rows_done, num_cols_done;
int force;
- num_rows_done = 0;
- num_cols_done = 0;
force = cfgPtr->force;
RF_CallocAndAdd(disks, raidPtr->numRow, sizeof(RF_RaidDisk_t *),
@@ -160,9 +159,10 @@
goto fail;
}
for (c = 0; c < raidPtr->numCol; c++) {
- ret = rf_ConfigureDisk(raidPtr,
- &cfgPtr->devnames[r][c][0],
- &disks[r][c], r, c);
+ ret = rf_ConfigureDisk(raidPtr,
+ &cfgPtr->devnames[r][c][0],
+ &disks[r][c], r, c);
+
if (ret)
goto fail;
@@ -185,14 +185,12 @@
(long int) disks[r][c].numBlocks *
disks[r][c].blockSize / 1024 / 1024);
}
- num_cols_done++;
}
/* XXX fix for n-fault tolerant */
/* XXX this should probably check to see how many failures
we can handle for this configuration! */
if (numFailuresThisRow > 0)
raidPtr->status[r] = rf_rs_degraded;
- num_rows_done++;
}
/* all disks must be the same size & have the same block size, bs must
@@ -343,11 +341,176 @@
*/
rf_UnconfigureVnodes( raidPtr );
-
+
return (ret);
}
+static int
+rf_AllocDiskStructures(raidPtr, cfgPtr)
+ RF_Raid_t *raidPtr;
+ RF_Config_t *cfgPtr;
+{
+ RF_RaidDisk_t **disks;
+ int ret;
+ int r;
+ RF_CallocAndAdd(disks, raidPtr->numRow, sizeof(RF_RaidDisk_t *),
+ (RF_RaidDisk_t **), raidPtr->cleanupList);
+ if (disks == NULL) {
+ ret = ENOMEM;
+ goto fail;
+ }
+ raidPtr->Disks = disks;
+ /* get space for the device-specific stuff... */
+ RF_CallocAndAdd(raidPtr->raid_cinfo, raidPtr->numRow,
+ sizeof(struct raidcinfo *), (struct raidcinfo **),
+ raidPtr->cleanupList);
+ if (raidPtr->raid_cinfo == NULL) {
+ ret = ENOMEM;
+ goto fail;
+ }
+
+ for (r = 0; r < raidPtr->numRow; r++) {
+ /* We allocate RF_MAXSPARE on the first row so that we
+ have room to do hot-swapping of spares */
+ RF_CallocAndAdd(disks[r], raidPtr->numCol
+ + ((r == 0) ? RF_MAXSPARE : 0),
+ sizeof(RF_RaidDisk_t), (RF_RaidDisk_t *),
+ raidPtr->cleanupList);
+ if (disks[r] == NULL) {
+ ret = ENOMEM;
+ goto fail;
+ }
+ /* get more space for device specific stuff.. */
+ RF_CallocAndAdd(raidPtr->raid_cinfo[r],
+ raidPtr->numCol + ((r == 0) ? raidPtr->numSpare : 0),
+ sizeof(struct raidcinfo), (struct raidcinfo *),
+ raidPtr->cleanupList);
+ if (raidPtr->raid_cinfo[r] == NULL) {
+ ret = ENOMEM;
+ goto fail;
+ }
+ }
+ return(0);
+fail:
+ rf_UnconfigureVnodes( raidPtr );
+
+ return(ret);
+}
+
+
+/* configure a single disk during auto-configuration at boot */
+int
+rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config)
+ RF_Raid_t *raidPtr;
+ RF_Config_t *cfgPtr;
+ RF_AutoConfig_t *auto_config;
+{
+ RF_RaidDisk_t **disks;
+ RF_RaidDisk_t *diskPtr;
+ RF_RowCol_t r, c;
+ RF_SectorCount_t min_numblks = (RF_SectorCount_t) 0x7FFFFFFFFFFFLL;
+ int bs, ret;
+ int numFailuresThisRow;
+ int force;
+ RF_AutoConfig_t *ac;
+
+#if DEBUG
+ printf("Starting autoconfiguration of RAID set...\n");
+#endif
+ force = cfgPtr->force;
+
+ ret = rf_AllocDiskStructures(raidPtr, cfgPtr);
+ if (ret)
+ goto fail;
+
+ disks = raidPtr->Disks;
+
+ for (r = 0; r < raidPtr->numRow; r++) {
+ numFailuresThisRow = 0;
+ for (c = 0; c < raidPtr->numCol; c++) {
Home |
Main Index |
Thread Index |
Old Index