CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: andvar Date: Sun Aug 8 21:45:53 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_parityscan.c Log Message: s/arry/array/ To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_parityscan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_parityscan.c diff -u src/sys/dev/raidframe/rf_parityscan.c:1.37 src/sys/dev/raidframe/rf_parityscan.c:1.38 --- src/sys/dev/raidframe/rf_parityscan.c:1.37 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_parityscan.c Sun Aug 8 21:45:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityscan.c,v 1.37 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_parityscan.c,v 1.38 2021/08/08 21:45:53 andvar Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.37 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.38 2021/08/08 21:45:53 andvar Exp $"); #include @@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_paritysca /* * - * walk through the entire arry and write new parity. This works by + * walk through the entire array and write new parity. This works by * creating two DAGs, one to read a stripe of data and one to write * new parity. The first is executed, the data is xored together, and * then the second is executed. To avoid constantly building and
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Mon Aug 2 22:37:29 UTC 2021 Modified Files: src/sys/dev/raidframe: raidframevar.h rf_raid.h Log Message: Accidentally commited some other changes that weren't quite ready. Add these changes to fix the build. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/raidframevar.h cvs rdiff -u -r1.49 -r1.50 src/sys/dev/raidframe/rf_raid.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/raidframevar.h diff -u src/sys/dev/raidframe/raidframevar.h:1.21 src/sys/dev/raidframe/raidframevar.h:1.22 --- src/sys/dev/raidframe/raidframevar.h:1.21 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/raidframevar.h Mon Aug 2 22:37:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: raidframevar.h,v 1.21 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: raidframevar.h,v 1.22 2021/08/02 22:37:29 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -355,6 +355,7 @@ typedef RF_uint32 RF_ReconReqFlags_t; /* flags that can be put in the rf_recon_req structure */ #define RF_FDFLAGS_NONE 0x0 /* just fail the disk */ #define RF_FDFLAGS_RECON 0x1 /* fail and initiate recon */ +#define RF_FDFLAGS_RECON_FORCE 0x2 /* fail and initiate recon, ignoring errors */ struct rf_recon_req { /* used to tell the kernel to fail a disk */ RF_RowCol_t col; Index: src/sys/dev/raidframe/rf_raid.h diff -u src/sys/dev/raidframe/rf_raid.h:1.49 src/sys/dev/raidframe/rf_raid.h:1.50 --- src/sys/dev/raidframe/rf_raid.h:1.49 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_raid.h Mon Aug 2 22:37:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid.h,v 1.49 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_raid.h,v 1.50 2021/08/02 22:37:29 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -187,6 +187,7 @@ struct RF_Raid_s { RF_HeadSepLimit_t headSepLimit; int numFloatingReconBufs; int reconInProgress; + int forceRecon; rf_declare_cond2(waitForReconCond); /* goes with raidPtr->mutex */ RF_RaidReconDesc_t *reconDesc; /* reconstruction descriptor */ RF_ReconCtrl_t *reconControl; /* reconstruction control structure
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Tue Jul 27 03:09:27 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_cvscan.c rf_cvscan.h Log Message: Missed cleaning up this "peek" routines the other day. Take care of it now. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_cvscan.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_cvscan.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_cvscan.c diff -u src/sys/dev/raidframe/rf_cvscan.c:1.17 src/sys/dev/raidframe/rf_cvscan.c:1.18 --- src/sys/dev/raidframe/rf_cvscan.c:1.17 Sat Feb 9 03:33:59 2019 +++ src/sys/dev/raidframe/rf_cvscan.c Tue Jul 27 03:09:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_cvscan.c,v 1.17 2019/02/09 03:33:59 christos Exp $ */ +/* $NetBSD: rf_cvscan.c,v 1.18 2021/07/27 03:09:26 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -35,7 +35,7 @@ **/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.17 2019/02/09 03:33:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.18 2021/07/27 03:09:26 oster Exp $"); #include #include "rf_alloclist.h" @@ -272,44 +272,6 @@ rf_CvscanDequeue(void *q_in) return (ret); } - - -RF_DiskQueueData_t * -rf_CvscanPeek(void *q_in) -{ - RF_CvscanHeader_t *hdr = (RF_CvscanHeader_t *) q_in; - longrange, i, sum_dist_left, sum_dist_right; - RF_DiskQueueData_t *tmp, *headElement; - - DO_CHECK_STATE(hdr); - - if (hdr->left_cnt == 0 && hdr->right_cnt == 0) - headElement = NULL; - else { - range = RF_MIN(hdr->range_for_avg, RF_MIN(hdr->left_cnt, hdr->right_cnt)); - for (i = 0, tmp = hdr->left, sum_dist_left = - ((hdr->direction == rf_cvscan_RIGHT) ? range * hdr->change_penalty : 0); - tmp != NULL && i < range; - tmp = tmp->next, i++) { - sum_dist_left += hdr->cur_block - tmp->sectorOffset; - } - for (i = 0, tmp = hdr->right, sum_dist_right = - ((hdr->direction == rf_cvscan_LEFT) ? range * hdr->change_penalty : 0); - tmp != NULL && i < range; - tmp = tmp->next, i++) { - sum_dist_right += tmp->sectorOffset - hdr->cur_block; - } - - if (hdr->right_cnt == 0 || sum_dist_left < sum_dist_right) - headElement = hdr->left; - else - headElement = hdr->right; - } - return (headElement); -} - - - /* ** CVSCAN( 1, 0 ) is Shortest Seek Time First (SSTF) **lowest average response time Index: src/sys/dev/raidframe/rf_cvscan.h diff -u src/sys/dev/raidframe/rf_cvscan.h:1.6 src/sys/dev/raidframe/rf_cvscan.h:1.7 --- src/sys/dev/raidframe/rf_cvscan.h:1.6 Sun Dec 11 12:23:37 2005 +++ src/sys/dev/raidframe/rf_cvscan.h Tue Jul 27 03:09:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_cvscan.h,v 1.6 2005/12/11 12:23:37 christos Exp $ */ +/* $NetBSD: rf_cvscan.h,v 1.7 2021/07/27 03:09:26 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -75,7 +75,6 @@ rf_CvscanCreate(RF_SectorCount_t sect_pe RF_AllocListElem_t * cl_list, RF_ShutdownList_t ** listp); voidrf_CvscanEnqueue(void *qptr, RF_DiskQueueData_t * req, int priority); RF_DiskQueueData_t *rf_CvscanDequeue(void *qptr); -RF_DiskQueueData_t *rf_CvscanPeek(void *qptr); int rf_CvscanPromote(void *qptr, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Tue Jul 27 03:01:48 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_copyback.c rf_dagfuncs.c rf_diskqueue.c rf_diskqueue.h rf_reconstruct.c Log Message: rf_CreateDiskQueueData() no longer uses waitflag, and will always succeed. Cleanup the error path for the (no longer needed) PR_NOWAIT cases. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/raidframe/rf_copyback.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/raidframe/rf_dagfuncs.c cvs rdiff -u -r1.61 -r1.62 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_diskqueue.h cvs rdiff -u -r1.126 -r1.127 src/sys/dev/raidframe/rf_reconstruct.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_copyback.c diff -u src/sys/dev/raidframe/rf_copyback.c:1.54 src/sys/dev/raidframe/rf_copyback.c:1.55 --- src/sys/dev/raidframe/rf_copyback.c:1.54 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_copyback.c Tue Jul 27 03:01:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_copyback.c,v 1.54 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_copyback.c,v 1.55 2021/07/27 03:01:48 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -38,7 +38,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.54 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.55 2021/07/27 03:01:48 oster Exp $"); #include @@ -335,12 +335,10 @@ rf_CopybackOne(RF_CopybackDesc_t *desc, /* create reqs to read the old location & write the new */ desc->readreq = rf_CreateDiskQueueData(RF_IO_TYPE_READ, spOffs, sectPerSU, desc->databuf, 0L, 0, rf_CopybackReadDoneProc, desc, - NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL, - PR_WAITOK); + NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL); desc->writereq = rf_CreateDiskQueueData(RF_IO_TYPE_WRITE, testOffs, sectPerSU, desc->databuf, 0L, 0, rf_CopybackWriteDoneProc, desc, - NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL, - PR_WAITOK); + NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL); desc->fcol = testCol; /* enqueue the read. the write will go out as part of the callback on Index: src/sys/dev/raidframe/rf_dagfuncs.c diff -u src/sys/dev/raidframe/rf_dagfuncs.c:1.32 src/sys/dev/raidframe/rf_dagfuncs.c:1.33 --- src/sys/dev/raidframe/rf_dagfuncs.c:1.32 Fri Jun 19 19:29:39 2020 +++ src/sys/dev/raidframe/rf_dagfuncs.c Tue Jul 27 03:01:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $ */ +/* $NetBSD: rf_dagfuncs.c,v 1.33 2021/07/27 03:01:48 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.33 2021/07/27 03:01:48 oster Exp $"); #include #include @@ -280,13 +280,10 @@ rf_DiskReadFuncForThreads(RF_DagNode_t * #else NULL, #endif - (void *) (node->dagHdr->raidPtr), 0, node->dagHdr->bp, PR_NOWAIT); - if (!req) { - (node->wakeFunc) (node, ENOMEM); - } else { - node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); - } + (void *) (node->dagHdr->raidPtr), 0, node->dagHdr->bp); + + node->dagFuncData = (void *) req; + rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); } @@ -314,14 +311,10 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t NULL, #endif (void *) (node->dagHdr->raidPtr), - 0, node->dagHdr->bp, PR_NOWAIT); + 0, node->dagHdr->bp); - if (!req) { - (node->wakeFunc) (node, ENOMEM); - } else { - node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); - } + node->dagFuncData = (void *) req; + rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); } /* * the undo function for disk nodes @@ -343,13 +336,10 @@ rf_DiskUndoFunc(RF_DagNode_t *node) NULL, #endif (void *) (node->dagHdr->raidPtr), - 0, NULL, PR_NOWAIT); - if (!req) - (node->wakeFunc) (node, ENOMEM); - else { - node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->col]), req, RF_IO_NORMAL_PRIORITY); - } + 0, NULL); + + node->dagFuncData = (void *) req; + rf_DiskIOEnqueue(&(dqs[pda->col]), req, RF_IO_NORMAL_PRIORITY); } /* Index: src/sys/dev/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.61 src/sys/dev/raidframe/rf_diskqueue.c:1.62 --- src/sys/dev/raidframe/rf_diskqueue.c:1.61 Fri Jul 23 20:18:24 2021 +++ src/sys/dev/raidframe
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Mon Jul 26 22:50:36 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Add support for detecting and configuring nested RAID setups at boot. To generate a diff of this commit: cvs rdiff -u -r1.396 -r1.397 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.396 src/sys/dev/raidframe/rf_netbsdkintf.c:1.397 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.396 Fri Jul 23 02:35:14 2021 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Jul 26 22:50:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.396 2021/07/23 02:35:14 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.397 2021/07/26 22:50:36 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.396 2021/07/23 02:35:14 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.397 2021/07/26 22:50:36 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -483,42 +483,56 @@ rf_containsboot(RF_Raid_t *r, device_t b static void rf_buildroothack(RF_ConfigSet_t *config_sets) { + RF_AutoConfig_t *ac_list; RF_ConfigSet_t *cset; RF_ConfigSet_t *next_cset; int num_root; + int raid_added; struct raid_softc *sc, *rsc; struct dk_softc *dksc = NULL; /* XXX gcc -Os: may be used uninit. */ sc = rsc = NULL; num_root = 0; - cset = config_sets; - while (cset != NULL) { - next_cset = cset->next; - if (rf_have_enough_components(cset) && - cset->ac->clabel->autoconfigure == 1) { - sc = rf_auto_config_set(cset); - if (sc != NULL) { -aprint_debug("raid%d: configured ok, rootable %d\n", -sc->sc_unit, cset->rootable); -if (cset->rootable) { - rsc = sc; - num_root++; + + raid_added = 1; + while (raid_added > 0) { + raid_added = 0; + cset = config_sets; + while (cset != NULL) { + next_cset = cset->next; + if (rf_have_enough_components(cset) && + cset->ac->clabel->autoconfigure == 1) { +sc = rf_auto_config_set(cset); +if (sc != NULL) { + aprint_debug("raid%d: configured ok, rootable %d\n", + sc->sc_unit, cset->rootable); + /* We added one RAID set */ + raid_added++; + if (cset->rootable) { + rsc = sc; + num_root++; + } +} else { + /* The autoconfig didn't work :( */ + aprint_debug("Autoconfig failed\n"); + rf_release_all_vps(cset); } } else { -/* The autoconfig didn't work :( */ -aprint_debug("Autoconfig failed\n"); +/* we're not autoconfiguring this set... + release the associated resources */ rf_release_all_vps(cset); } - } else { - /* we're not autoconfiguring this set... - release the associated resources */ - rf_release_all_vps(cset); + /* cleanup */ + rf_cleanup_config_set(cset); + cset = next_cset; + } + if (raid_added > 0) { + /* We added at least one RAID set, so re-scan for recursive RAID */ + ac_list = rf_find_raid_components(); + config_sets = rf_create_auto_sets(ac_list); } - /* cleanup */ - rf_cleanup_config_set(cset); - cset = next_cset; } - + /* if the user has specified what the root device should be then we don't touch booted_device or boothowto... */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 22:34:12 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_raid1.c Log Message: The number of components used must be at least 2. An odd number of components is not allowed. PR bin/45162 To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/raidframe/rf_raid1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_raid1.c diff -u src/sys/dev/raidframe/rf_raid1.c:1.38 src/sys/dev/raidframe/rf_raid1.c:1.39 --- src/sys/dev/raidframe/rf_raid1.c:1.38 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_raid1.c Fri Jul 23 22:34:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid1.c,v 1.38 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_raid1.c,v 1.39 2021/07/23 22:34:12 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.38 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.39 2021/07/23 22:34:12 oster Exp $"); #include "rf_raid.h" #include "rf_raid1.h" @@ -65,6 +65,11 @@ rf_ConfigureRAID1(RF_ShutdownList_t **li RF_Raid1ConfigInfo_t *info; RF_RowCol_t i; + /* Sanity check the number of columns... */ + if (raidPtr->numCol < 2 || raidPtr->numCol % 2 != 0) { + return (EINVAL); + } + /* create a RAID level 1 configuration structure */ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList); if (info == NULL)
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 20:18:24 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_diskqueue.c rf_diskqueue.h rf_fifo.c rf_fifo.h rf_sstf.c rf_sstf.h Log Message: Various disk queue "peek" routines were only ever used in the simulator version of RAIDFrame. Remove them from here. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/raidframe/rf_diskqueue.h cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_fifo.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_fifo.h cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_sstf.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/raidframe/rf_sstf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.60 src/sys/dev/raidframe/rf_diskqueue.c:1.61 --- src/sys/dev/raidframe/rf_diskqueue.c:1.60 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_diskqueue.c Fri Jul 23 20:18:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.60 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.61 2021/07/23 20:18:24 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.60 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.61 2021/07/23 20:18:24 oster Exp $"); #include @@ -115,36 +115,31 @@ static const RF_DiskQueueSW_t diskqueues rf_FifoCreate, rf_FifoEnqueue, rf_FifoDequeue, - rf_FifoPeek, - rf_FifoPromote}, + rf_FifoPromote}, {"cvscan", /* cvscan */ rf_CvscanCreate, rf_CvscanEnqueue, rf_CvscanDequeue, - rf_CvscanPeek, - rf_CvscanPromote}, + rf_CvscanPromote}, {"sstf", /* shortest seek time first */ rf_SstfCreate, rf_SstfEnqueue, rf_SstfDequeue, - rf_SstfPeek, - rf_SstfPromote}, + rf_SstfPromote}, {"scan", /* SCAN (two-way elevator) */ rf_ScanCreate, rf_SstfEnqueue, rf_ScanDequeue, - rf_ScanPeek, - rf_SstfPromote}, + rf_SstfPromote}, {"cscan", /* CSCAN (one-way elevator) */ rf_CscanCreate, rf_SstfEnqueue, rf_CscanDequeue, - rf_CscanPeek, - rf_SstfPromote}, + rf_SstfPromote}, }; #define NUM_DISK_QUEUE_TYPES (sizeof(diskqueuesw)/sizeof(RF_DiskQueueSW_t)) Index: src/sys/dev/raidframe/rf_diskqueue.h diff -u src/sys/dev/raidframe/rf_diskqueue.h:1.27 src/sys/dev/raidframe/rf_diskqueue.h:1.28 --- src/sys/dev/raidframe/rf_diskqueue.h:1.27 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_diskqueue.h Fri Jul 23 20:18:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.h,v 1.27 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_diskqueue.h,v 1.28 2021/07/23 20:18:24 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -89,7 +89,6 @@ struct RF_DiskQueueSW_s { * system */ void(*Enqueue) (void *, RF_DiskQueueData_t *, int); /* enqueue routine */ RF_DiskQueueData_t *(*Dequeue) (void *); /* dequeue routine */ - RF_DiskQueueData_t *(*Peek) (void *); /* peek at head of queue */ /* the rest are optional: they improve performance, but the driver * will deal with it if they don't exist */ Index: src/sys/dev/raidframe/rf_fifo.c diff -u src/sys/dev/raidframe/rf_fifo.c:1.16 src/sys/dev/raidframe/rf_fifo.c:1.17 --- src/sys/dev/raidframe/rf_fifo.c:1.16 Sat Feb 9 03:34:00 2019 +++ src/sys/dev/raidframe/rf_fifo.c Fri Jul 23 20:18:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_fifo.c,v 1.16 2019/02/09 03:34:00 christos Exp $ */ +/* $NetBSD: rf_fifo.c,v 1.17 2021/07/23 20:18:24 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -36,7 +36,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.16 2019/02/09 03:34:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.17 2021/07/23 20:18:24 oster Exp $"); #include @@ -147,23 +147,6 @@ rf_FifoDequeue(void *q_in) return (nd); } -/* Return ptr to item at head of queue. Used to examine request - * info without actually dequeueing the request. - */ -RF_DiskQueueData_t * -rf_FifoPeek(void *q_in) -{ - RF_DiskQueueData_t *headElement = NULL; - RF_FifoHeader_t *q = (RF_FifoHeader_t *) q_in; - - RF_ASSERT(q); - if (q->hq_head) - headElement = q->hq_head; - else - if (q->lq_head) - headElement = q->lq_head; - return (headElement); -} /* We sometimes need to promote a low priority access to a regular priority access. * Currently, this is only used when the user wants to write a stripe which is currently * under reconstruction. Index: src/sys/dev/raidframe/rf_fifo.h diff -u src/sys/dev/raidframe/rf_fifo.h:1.6 src/sys/dev/raidfr
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 02:35:14 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_desc.h rf_driver.c rf_driver.h rf_netbsdkintf.c rf_states.c Log Message: All IO is async in the RAIDframe kernel driver, so desc->async_flag isn't needed. Cleanup the flag from rf_DoAccess() and its caller as well. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_desc.h cvs rdiff -u -r1.138 -r1.139 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_driver.h cvs rdiff -u -r1.395 -r1.396 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.52 -r1.53 src/sys/dev/raidframe/rf_states.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_desc.h diff -u src/sys/dev/raidframe/rf_desc.h:1.21 src/sys/dev/raidframe/rf_desc.h:1.22 --- src/sys/dev/raidframe/rf_desc.h:1.21 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/rf_desc.h Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_desc.h,v 1.21 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: rf_desc.h,v 1.22 2021/07/23 02:35:14 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -91,7 +91,6 @@ struct RF_RaidAccessDesc_s { * I/O */ void *callbackArg; /* arg to give to callback func */ RF_RaidAccessDesc_t *next; - int async_flag; RF_Etimer_t timer; /* used for timing this access */ }; #endif/* !_RF__RF_DESC_H_ */ Index: src/sys/dev/raidframe/rf_driver.c diff -u src/sys/dev/raidframe/rf_driver.c:1.138 src/sys/dev/raidframe/rf_driver.c:1.139 --- src/sys/dev/raidframe/rf_driver.c:1.138 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_driver.c Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.138 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.138 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -665,13 +665,11 @@ rf_FreeRaidAccDesc(RF_RaidAccessDesc_t * * 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 + * type should be read or write. 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, +rf_DoAccess(RF_Raid_t * raidPtr, RF_IoType_t type, RF_RaidAddr_t raidAddress, RF_SectorCount_t numBlocks, void *bufPtr, struct buf *bp, RF_RaidAccessFlags_t flags) { RF_RaidAccessDesc_t *desc; @@ -704,7 +702,6 @@ rf_DoAccess(RF_Raid_t * raidPtr, RF_IoTy #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) Index: src/sys/dev/raidframe/rf_driver.h diff -u src/sys/dev/raidframe/rf_driver.h:1.20 src/sys/dev/raidframe/rf_driver.h:1.21 --- src/sys/dev/raidframe/rf_driver.h:1.20 Sat Dec 26 00:58:45 2015 +++ src/sys/dev/raidframe/rf_driver.h Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.h,v 1.20 2015/12/26 00:58:45 pgoyette Exp $ */ +/* $NetBSD: rf_driver.h,v 1.21 2021/07/23 02:35:14 oster Exp $ */ /* * rf_driver.h */ @@ -52,7 +52,7 @@ RF_RaidAccessDesc_t *rf_AllocRaidAccDesc RF_RaidAccessFlags_t, const RF_AccessState_t *); void rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *); -int rf_DoAccess(RF_Raid_t *, RF_IoType_t, int, RF_RaidAddr_t, +int rf_DoAccess(RF_Raid_t *, RF_IoType_t, RF_RaidAddr_t, RF_SectorCount_t, void *, struct buf *, RF_RaidAccessFlags_t); #if 0 Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.395 src/sys/dev/raidframe/rf_netbsdkintf.c:1.396 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.395 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.395 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.396 2021/07/23 02:35:14 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.395 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 02:18:26 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_netbsd.h Log Message: The 'pss_issued' pool is unused, so remove it. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsd.h diff -u src/sys/dev/raidframe/rf_netbsd.h:1.37 src/sys/dev/raidframe/rf_netbsd.h:1.38 --- src/sys/dev/raidframe/rf_netbsd.h:1.37 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_netbsd.h Fri Jul 23 02:18:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.37 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.38 2021/07/23 02:18:26 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,6 @@ struct RF_Pools_s { struct pool mcpair; /* Mutex/Cond Pairs */ struct pool pda; /* Physical Disk Access structures */ struct pool pss; /* Parity Stripe Status */ - struct pool pss_issued; /* Parity Stripe Status Issued */ struct pool rad; /* Raid Access Descriptors */ struct pool reconbuffer; /* reconstruction buffer (header) pool */ struct pool revent; /* reconstruct events */ @@ -100,7 +99,6 @@ struct RF_PoolNames_s { char mcpair[RF_MAX_POOLNAMELEN]; /* Mutex/Cond Pairs */ char pda[RF_MAX_POOLNAMELEN]; /* Physical Disk Access structures */ char pss[RF_MAX_POOLNAMELEN]; /* Parity Stripe Status */ - char pss_issued[RF_MAX_POOLNAMELEN]; /* Parity Stripe Status Issued */ char rad[RF_MAX_POOLNAMELEN]; /* Raid Access Descriptors */ char reconbuffer[RF_MAX_POOLNAMELEN]; /* reconstruction buffer (header) pool */ char revent[RF_MAX_POOLNAMELEN]; /* reconstruct events */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 00:54:45 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_alloclist.c rf_aselect.c rf_callback.c rf_callback.h rf_copyback.c rf_dagdegrd.c rf_dagdegwr.c rf_dagffrd.c rf_dagffwr.c rf_dagutils.c rf_dagutils.h rf_diskqueue.c rf_diskqueue.h rf_driver.c rf_evenodd.c rf_map.c rf_map.h rf_mcpair.c rf_mcpair.h rf_netbsd.h rf_netbsdkintf.c rf_paritylogDiskMgr.c rf_parityscan.c rf_psstatus.c rf_psstatus.h rf_raid.h rf_raid1.c rf_reconbuffer.c rf_reconstruct.c rf_reconstruct.h rf_reconutil.c rf_revent.c rf_revent.h rf_states.c rf_stripelocks.c rf_stripelocks.h Log Message: Extensive mechanical changes to the pools used in RAIDframe. Alloclist remains not per-RAID, so initialize that pool separately/differently than the rest. The remainder of pools in RF_Pools_s are now per-RAID pools. Mostly mechanical changes to functions to allocate/destroy per-RAID pools. Needed to make raidPtr available in certain cases to be able to find the per-RAID pools. Extend rf_pool_init() to now populate a per-RAID wchan value that is unique to each pool for a given RAID device. TODO: Complete the analysis of the minimum number of items that are required for each pool to allow IO to progress (i.e. so that a request for pool resources can always be satisfied), and dynamically scale minimum pool sizes based on RAID configuration. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_alloclist.c \ src/sys/dev/raidframe/rf_revent.c cvs rdiff -u -r1.29 -r1.30 src/sys/dev/raidframe/rf_aselect.c \ src/sys/dev/raidframe/rf_reconstruct.h cvs rdiff -u -r1.24 -r1.25 src/sys/dev/raidframe/rf_callback.c \ src/sys/dev/raidframe/rf_mcpair.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/raidframe/rf_callback.h cvs rdiff -u -r1.53 -r1.54 src/sys/dev/raidframe/rf_copyback.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/raidframe/rf_dagdegrd.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_dagdegwr.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_dagffrd.c \ src/sys/dev/raidframe/rf_dagutils.h cvs rdiff -u -r1.36 -r1.37 src/sys/dev/raidframe/rf_dagffwr.c \ src/sys/dev/raidframe/rf_netbsd.h src/sys/dev/raidframe/rf_parityscan.c cvs rdiff -u -r1.57 -r1.58 src/sys/dev/raidframe/rf_dagutils.c cvs rdiff -u -r1.59 -r1.60 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/raidframe/rf_diskqueue.h \ src/sys/dev/raidframe/rf_reconbuffer.c cvs rdiff -u -r1.137 -r1.138 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/raidframe/rf_evenodd.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/raidframe/rf_map.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/raidframe/rf_map.h cvs rdiff -u -r1.10 -r1.11 src/sys/dev/raidframe/rf_mcpair.h \ src/sys/dev/raidframe/rf_revent.h cvs rdiff -u -r1.394 -r1.395 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.30 -r1.31 src/sys/dev/raidframe/rf_paritylogDiskMgr.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_psstatus.c \ src/sys/dev/raidframe/rf_raid1.c src/sys/dev/raidframe/rf_reconutil.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/raidframe/rf_psstatus.h cvs rdiff -u -r1.48 -r1.49 src/sys/dev/raidframe/rf_raid.h cvs rdiff -u -r1.125 -r1.126 src/sys/dev/raidframe/rf_reconstruct.c cvs rdiff -u -r1.51 -r1.52 src/sys/dev/raidframe/rf_states.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_stripelocks.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_stripelocks.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_alloclist.c diff -u src/sys/dev/raidframe/rf_alloclist.c:1.28 src/sys/dev/raidframe/rf_alloclist.c:1.29 --- src/sys/dev/raidframe/rf_alloclist.c:1.28 Sun Feb 10 17:13:33 2019 +++ src/sys/dev/raidframe/rf_alloclist.c Fri Jul 23 00:54:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_alloclist.c,v 1.28 2019/02/10 17:13:33 christos Exp $ */ +/* $NetBSD: rf_alloclist.c,v 1.29 2021/07/23 00:54:45 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.28 2019/02/10 17:13:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.29 2021/07/23 00:54:45 oster Exp $"); #include @@ -59,15 +59,17 @@ static void rf_ShutdownAllocList(void *) static void rf_ShutdownAllocList(void *ignored) { - pool_destroy(&rf_pools.alloclist); + pool_destroy(&rf_alloclist_pool); } int rf_ConfigureAllocList(RF_ShutdownList_t **listp) { - rf_pool_init(&rf_pools.alloclist, sizeof(RF_AllocListElem_t), - "rf_alloclist_pl", RF_AL_FREELIST_MIN, RF_AL_FREELIST_MAX); + pool_init(&rf_alloclist_pool, sizeof(RF_AllocListElem_t), 0, 0, 0, "rf_alloclist_pl", NU
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 00:26:20 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_diskqueue.c rf_netbsd.h Log Message: getiobuf() can return NULL if there are no IO buffers available. RAIDframe can't deal with that, so create a dedicated pool of buffers to use for IO. PR_WAITOK is fine here, as we pre-allocate more than we need to guarantee IO can make progress. Tuning of pool still to come. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.58 src/sys/dev/raidframe/rf_diskqueue.c:1.59 --- src/sys/dev/raidframe/rf_diskqueue.c:1.58 Fri Jun 19 19:32:03 2020 +++ src/sys/dev/raidframe/rf_diskqueue.c Fri Jul 23 00:26:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.59 2021/07/23 00:26:19 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.59 2021/07/23 00:26:19 oster Exp $"); #include @@ -84,6 +84,8 @@ __KERNEL_RCSID(0, "$NetBSD: rf_diskqueue #include "rf_fifo.h" #include "rf_kintf.h" +#include + static void rf_ShutdownDiskQueueSystem(void *); #ifndef RF_DEBUG_DISKQUEUE @@ -147,10 +149,15 @@ static const RF_DiskQueueSW_t diskqueues }; #define NUM_DISK_QUEUE_TYPES (sizeof(diskqueuesw)/sizeof(RF_DiskQueueSW_t)) + #define RF_MAX_FREE_DQD 256 #define RF_MIN_FREE_DQD 64 -#include +/* XXX: scale these... */ +#define RF_MAX_FREE_BUFIO 256 +#define RF_MIN_FREE_BUFIO 64 + + /* configures a single disk queue */ @@ -189,6 +196,7 @@ static void rf_ShutdownDiskQueueSystem(void *ignored) { pool_destroy(&rf_pools.dqd); + pool_destroy(&rf_pools.bufio); } int @@ -197,6 +205,8 @@ rf_ConfigureDiskQueueSystem(RF_ShutdownL rf_pool_init(&rf_pools.dqd, sizeof(RF_DiskQueueData_t), "rf_dqd_pl", RF_MIN_FREE_DQD, RF_MAX_FREE_DQD); + rf_pool_init(&rf_pools.bufio, sizeof(buf_t), + "rf_bufio_pl", RF_MIN_FREE_BUFIO, RF_MAX_FREE_BUFIO); rf_ShutdownCreate(listp, rf_ShutdownDiskQueueSystem, NULL); return (0); @@ -367,19 +377,20 @@ rf_CreateDiskQueueData(RF_IoType_t typ, { RF_DiskQueueData_t *p; - p = pool_get(&rf_pools.dqd, waitflag | PR_ZERO); - if (p == NULL) - return (NULL); + p = pool_get(&rf_pools.dqd, PR_WAITOK | PR_ZERO); + KASSERT(p != NULL); - if (waitflag == PR_WAITOK) { - p->bp = getiobuf(NULL, true); - } else { - p->bp = getiobuf(NULL, false); - } - if (p->bp == NULL) { - pool_put(&rf_pools.dqd, p); - return (NULL); - } + /* Obtain a buffer from our own pool. It is possible for the + regular getiobuf() to run out of memory and return NULL. + We need to guarantee that never happens, as RAIDframe + doesn't have a good way to recover if memory allocation + fails here. + */ + p->bp = pool_get(&rf_pools.bufio, PR_WAITOK | PR_ZERO); + KASSERT(p->bp != NULL); + + buf_init(p->bp); + SET(p->bp->b_cflags, BC_BUSY); /* mark buffer busy */ if (mbp) { SET(p->bp->b_flags, mbp->b_flags & rf_b_pass); @@ -405,6 +416,6 @@ rf_CreateDiskQueueData(RF_IoType_t typ, void rf_FreeDiskQueueData(RF_DiskQueueData_t *p) { - putiobuf(p->bp); + pool_put(&rf_pools.bufio, p->bp); pool_put(&rf_pools.dqd, p); } Index: src/sys/dev/raidframe/rf_netbsd.h diff -u src/sys/dev/raidframe/rf_netbsd.h:1.35 src/sys/dev/raidframe/rf_netbsd.h:1.36 --- src/sys/dev/raidframe/rf_netbsd.h:1.35 Fri Jun 19 19:29:39 2020 +++ src/sys/dev/raidframe/rf_netbsd.h Fri Jul 23 00:26:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.35 2020/06/19 19:29:39 jdolecek Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.36 2021/07/23 00:26:19 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -61,6 +61,7 @@ struct RF_Pools_s { struct pool asm_hdr; /* Access Stripe Map Header */ struct pool asmap; /* Access Stripe Map */ struct pool asmhle; /* Access Stripe Map Header List Elements */ + struct pool bufio; /* Buffer IO Pool */ struct pool callbackf; /* Callback function descriptors */ struct pool callbackv; /* Callback value descriptors */ struct pool dagh;/* DAG headers */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Wed Jul 21 23:10:12 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_shutdown.c Log Message: Remove commented line that is a duplicate of a real line. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_shutdown.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_shutdown.c diff -u src/sys/dev/raidframe/rf_shutdown.c:1.20 src/sys/dev/raidframe/rf_shutdown.c:1.21 --- src/sys/dev/raidframe/rf_shutdown.c:1.20 Wed Dec 17 20:51:34 2008 +++ src/sys/dev/raidframe/rf_shutdown.c Wed Jul 21 23:10:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_shutdown.c,v 1.20 2008/12/17 20:51:34 cegger Exp $ */ +/* $NetBSD: rf_shutdown.c,v 1.21 2021/07/21 23:10:12 oster Exp $ */ /* * rf_shutdown.c */ @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_shutdown.c,v 1.20 2008/12/17 20:51:34 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_shutdown.c,v 1.21 2021/07/21 23:10:12 oster Exp $"); #include @@ -71,8 +71,6 @@ _rf_ShutdownCreate(RF_ShutdownList_t **l * Have to directly allocate memory here, since we start up before * and shutdown after RAIDframe internal allocation system. */ - /* ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), - M_RAIDFRAME, M_WAITOK); */ ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), M_RAIDFRAME, M_WAITOK); ent->cleanup = cleanup;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Wed May 26 06:11:50 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_compat80.c rf_driver.c rf_netbsdkintf.c Log Message: support different endian raidframe component label. there are two on-disk formats in use in raidframe: - the component label - the parity map the parity map is a bitmap implemented as bytes, so it has no endian issue. the component label is the problem, as most of the fields are 32 bit. this change only supports version 2 of raidframe (active since the year 2000.) as component labels are read and used before a raidPtr for the raid set has been created, there is no obvious storage for the swapped indicator, so the in-core version remains the on-disk version, while the rest of in-core label is swapped. in raidread_component_label() and raidwrite_component_label(), check if the swapped version, and if so, call new rf_swap_label() and ensure that the in-core label is native-byte order. for the write method, an on-stack copy is modified before writing, so that the in-core version remains valid. (this stack usage is below other stack usage in similar functions here.) adjust the label ioctls RAIDFRAME_GET_COMPONENT_LABEL and RAIDFRAME_GET_COMPONENT_LABEL80 to return the byte-swapped version so that eg, raidctl -s reports the right version. when performing final configuration of a raidset, report if a label swapped, and also complain if there are differently swapped versions on the other components. tested on arm64, sparc64 and amd64 ok @oster To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/raidframe/rf_compat80.c cvs rdiff -u -r1.136 -r1.137 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.393 -r1.394 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_compat80.c diff -u src/sys/dev/raidframe/rf_compat80.c:1.14 src/sys/dev/raidframe/rf_compat80.c:1.15 --- src/sys/dev/raidframe/rf_compat80.c:1.14 Thu Dec 12 02:15:43 2019 +++ src/sys/dev/raidframe/rf_compat80.c Wed May 26 06:11:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80.c,v 1.14 2019/12/12 02:15:43 pgoyette Exp $ */ +/* $NetBSD: rf_compat80.c,v 1.15 2021/05/26 06:11:50 mrg Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -215,6 +215,10 @@ rf_get_component_label80(RF_Raid_t *raid } rf_get_component_label(raidPtr, clabel); + /* Fix-up for userland. */ + if (clabel->version == bswap32(RF_COMPONENT_LABEL_VERSION)) + clabel->version = RF_COMPONENT_LABEL_VERSION; + retcode = copyout(clabel, *clabel_ptr, sizeof(**clabel_ptr)); RF_Free(clabel, sizeof(*clabel)); Index: src/sys/dev/raidframe/rf_driver.c diff -u src/sys/dev/raidframe/rf_driver.c:1.136 src/sys/dev/raidframe/rf_driver.c:1.137 --- src/sys/dev/raidframe/rf_driver.c:1.136 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/rf_driver.c Wed May 26 06:11:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.136 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: rf_driver.c,v 1.137 2021/05/26 06:11:50 mrg Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.136 2019/10/10 03:43:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.137 2021/05/26 06:11:50 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -300,6 +300,8 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf { RF_RowCol_t col; int rc; + bool swapped = false; + bool first = true; rf_lock_mutex2(configureMutex); configureCount++; @@ -430,10 +432,21 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf printf("raid%d: Components:", raidPtr->raidid); for (col = 0; col < raidPtr->numCol; col++) { + RF_ComponentLabel_t *clabel; + bool compswapped; + printf(" %s", raidPtr->Disks[col].devname); if (RF_DEAD_DISK(raidPtr->Disks[col].status)) { printf("[**FAILED**]"); } + clabel = raidget_component_label(raidPtr, col); + compswapped = clabel->version == + bswap32(RF_COMPONENT_LABEL_VERSION); + if (first) + swapped = compswapped; + else if (swapped != compswapped) + printf("raid%d: Component %d has different endian " + "than first component.", raidPtr->raidid, col); } printf("\n"); printf("raid%d: Total Sectors: %" PRIu64 " (%" PRIu64 " MB)\n", @@ -441,6 +454,9 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf raidPtr->totalSectors, (raidPtr->totalSectors / 1024 * (1 << raidPtr->logBytesPerSector) / 1024)); + if (swapped) + printf("raid%d: Using swapped-endian component labels.\n", + raidPtr->raidid); return (0); } Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.393 src/sys/dev/raidframe/rf_netbsdkintf.c:1.394 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.393 Mon May 24 07:43:15 2021 +++ src/sys/dev/raidfra
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Mon May 24 07:43:15 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: make various things static, and minor KNF clean up. ignore spiflash as a raid device. To generate a diff of this commit: cvs rdiff -u -r1.392 -r1.393 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.392 src/sys/dev/raidframe/rf_netbsdkintf.c:1.393 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.392 Mon Apr 26 07:27:24 2021 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon May 24 07:43:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.392 2021/04/26 07:27:24 mrg Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.393 2021/05/24 07:43:15 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.392 2021/04/26 07:27:24 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.393 2021/05/24 07:43:15 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -300,24 +300,23 @@ static int raid_detach_unlocked(struct r static void rf_markalldirty(RF_Raid_t *); static void rf_set_geometry(struct raid_softc *, RF_Raid_t *); -void rf_ReconThread(struct rf_recon_req_internal *); -void rf_RewriteParityThread(RF_Raid_t *raidPtr); -void rf_CopybackThread(RF_Raid_t *raidPtr); -void rf_ReconstructInPlaceThread(struct rf_recon_req_internal *); -int rf_autoconfig(device_t); -void rf_buildroothack(RF_ConfigSet_t *); +static void rf_ReconThread(struct rf_recon_req_internal *); +static void rf_RewriteParityThread(RF_Raid_t *raidPtr); +static void rf_CopybackThread(RF_Raid_t *raidPtr); +static void rf_ReconstructInPlaceThread(struct rf_recon_req_internal *); +static int rf_autoconfig(device_t); +static void rf_buildroothack(RF_ConfigSet_t *); -RF_AutoConfig_t *rf_find_raid_components(void); -RF_ConfigSet_t *rf_create_auto_sets(RF_AutoConfig_t *); +static RF_AutoConfig_t *rf_find_raid_components(void); +static RF_ConfigSet_t *rf_create_auto_sets(RF_AutoConfig_t *); static int rf_does_it_fit(RF_ConfigSet_t *,RF_AutoConfig_t *); -int rf_reasonable_label(RF_ComponentLabel_t *, uint64_t); -void rf_create_configuration(RF_AutoConfig_t *,RF_Config_t *, RF_Raid_t *); -int rf_set_autoconfig(RF_Raid_t *, int); -int rf_set_rootpartition(RF_Raid_t *, int); -void rf_release_all_vps(RF_ConfigSet_t *); -void rf_cleanup_config_set(RF_ConfigSet_t *); -int rf_have_enough_components(RF_ConfigSet_t *); -struct raid_softc *rf_auto_config_set(RF_ConfigSet_t *); +static void rf_create_configuration(RF_AutoConfig_t *,RF_Config_t *, RF_Raid_t *); +static int rf_set_autoconfig(RF_Raid_t *, int); +static int rf_set_rootpartition(RF_Raid_t *, int); +static void rf_release_all_vps(RF_ConfigSet_t *); +static void rf_cleanup_config_set(RF_ConfigSet_t *); +static int rf_have_enough_components(RF_ConfigSet_t *); +static struct raid_softc *rf_auto_config_set(RF_ConfigSet_t *); static void rf_fix_old_label_size(RF_ComponentLabel_t *, uint64_t); /* @@ -397,7 +396,7 @@ raidattach(int num) */ } -int +static int rf_autoconfig(device_t self) { RF_AutoConfig_t *ac_list; @@ -481,7 +480,7 @@ rf_containsboot(RF_Raid_t *r, device_t b return 0; } -void +static void rf_buildroothack(RF_ConfigSet_t *config_sets) { RF_ConfigSet_t *cset; @@ -2614,7 +2613,7 @@ rf_UnconfigureVnodes(RF_Raid_t *raidPtr) } -void +static void rf_ReconThread(struct rf_recon_req_internal *req) { int s; @@ -2636,7 +2635,7 @@ rf_ReconThread(struct rf_recon_req_inter kthread_exit(0); /* does not return */ } -void +static void rf_RewriteParityThread(RF_Raid_t *raidPtr) { int retcode; @@ -2670,7 +2669,7 @@ rf_RewriteParityThread(RF_Raid_t *raidPt } -void +static void rf_CopybackThread(RF_Raid_t *raidPtr) { int s; @@ -2686,7 +2685,7 @@ rf_CopybackThread(RF_Raid_t *raidPtr) } -void +static void rf_ReconstructInPlaceThread(struct rf_recon_req_internal *req) { int s; @@ -2746,7 +2745,7 @@ rf_get_component(RF_AutoConfig_t *ac_lis return ac_list; } -RF_AutoConfig_t * +static RF_AutoConfig_t * rf_find_raid_components(void) { struct vnode *vp; @@ -2775,21 +2774,21 @@ rf_find_raid_components(void) for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST); dv != NULL; dv = deviter_next(&di)) { - /* we are only interested in disks... */ + /* we are only interested in disks */ if (device_class(dv) != DV_DISK) continue; - /* we don't care about floppies... */ + /* we don't care about floppies */ if (device_is_a(dv, "fd")) { continue; } - /* we don't care about CD's... */ + /* we don't care about CDs. */ if (device_is_a(dv, "cd"))
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Mon Apr 26 07:27:25 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: if raidframe sets booted_device, log a debug message about it. To generate a diff of this commit: cvs rdiff -u -r1.391 -r1.392 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.391 src/sys/dev/raidframe/rf_netbsdkintf.c:1.392 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.391 Sun Apr 11 01:41:12 2021 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Apr 26 07:27:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.391 2021/04/11 01:41:12 mrg Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.392 2021/04/26 07:27:24 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.391 2021/04/11 01:41:12 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.392 2021/04/26 07:27:24 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -581,6 +581,8 @@ rf_buildroothack(RF_ConfigSet_t *config_ booted_device = candidate_root; booted_method = "raidframe/single"; booted_partition = 0; /* XXX assume 'a' */ + DPRINTF("%s: set booted_device=%s(%p)\n", __func__, + device_xname(booted_device), booted_device); } } else if (num_root > 1) { DPRINTF("%s: many roots=%d, %p\n", __func__, num_root,
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Sun Apr 11 01:41:13 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: mark an extremely uncommon, but sometimes seen, log message with the function name it comes with. To generate a diff of this commit: cvs rdiff -u -r1.390 -r1.391 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.390 src/sys/dev/raidframe/rf_netbsdkintf.c:1.391 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.390 Sun Sep 27 21:39:08 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Apr 11 01:41:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.390 2020/09/27 21:39:08 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.391 2021/04/11 01:41:12 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.390 2020/09/27 21:39:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.391 2021/04/11 01:41:12 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -1986,7 +1986,7 @@ rf_DispatchKernelIO(RF_DiskQueue_t *queu /* XXX need to do something extra here.. */ /* I'm leaving this in, as I've never actually seen it used, * and I'd like folks to report it... GO */ - printf(("WAKEUP CALLED\n")); + printf("%s: WAKEUP CALLED\n", __func__); queue->numOutstanding++; bp->b_flags = 0;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Mon Feb 15 23:27:03 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_reconstruct.c Log Message: Fix a long long-standing off-by-one error in computing lastPSID. SUsPerPU is only really supported for a value of 1, and since the first PSID is 0, the last will be numStripe-1. Also update the setting of pending_writes to reflect the change to lastPSID. Needs pullups to -8 and -9. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/sys/dev/raidframe/rf_reconstruct.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_reconstruct.c diff -u src/sys/dev/raidframe/rf_reconstruct.c:1.124 src/sys/dev/raidframe/rf_reconstruct.c:1.125 --- src/sys/dev/raidframe/rf_reconstruct.c:1.124 Sun Dec 8 12:14:40 2019 +++ src/sys/dev/raidframe/rf_reconstruct.c Mon Feb 15 23:27:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconstruct.c,v 1.124 2019/12/08 12:14:40 mlelstv Exp $ */ +/* $NetBSD: rf_reconstruct.c,v 1.125 2021/02/15 23:27:03 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.124 2019/12/08 12:14:40 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.125 2021/02/15 23:27:03 oster Exp $"); #include #include @@ -616,7 +616,7 @@ rf_ContinueReconstructFailedDisk(RF_Raid mapPtr = raidPtr->reconControl->reconMap; incPSID = RF_RECONMAP_SIZE; - lastPSID = raidPtr->Layout.numStripe / raidPtr->Layout.SUsPerPU; + lastPSID = raidPtr->Layout.numStripe / raidPtr->Layout.SUsPerPU - 1; RUsPerPU = raidPtr->Layout.SUsPerPU / raidPtr->Layout.SUsPerRU; recon_error = 0; write_error = 0; @@ -631,7 +631,7 @@ rf_ContinueReconstructFailedDisk(RF_Raid raidPtr->reconControl->lastPSID = lastPSID; if (pending_writes > lastPSID) - pending_writes = lastPSID; + pending_writes = lastPSID + 1; /* start the actual reconstruction */ @@ -796,7 +796,6 @@ rf_ContinueReconstructFailedDisk(RF_Raid pending_writes = lastPSID - prev; raidPtr->reconControl->lastPSID = lastPSID; } - /* back down curPSID to get ready for the next round... */ for (i = 0; i < raidPtr->numCol; i++) { if (i != col) {
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Sun Sep 27 21:39:08 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_kintf.h rf_netbsdkintf.c rf_paritymap.c Log Message: DIOCCACHESYNC takes an int argument, pass it through. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_kintf.h cvs rdiff -u -r1.389 -r1.390 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_paritymap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_kintf.h diff -u src/sys/dev/raidframe/rf_kintf.h:1.25 src/sys/dev/raidframe/rf_kintf.h:1.26 --- src/sys/dev/raidframe/rf_kintf.h:1.25 Wed Jan 17 19:32:49 2018 +++ src/sys/dev/raidframe/rf_kintf.h Sun Sep 27 17:39:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_kintf.h,v 1.25 2018/01/18 00:32:49 mrg Exp $ */ +/* $NetBSD: rf_kintf.h,v 1.26 2020/09/27 21:39:08 christos Exp $ */ /* * rf_kintf.h * @@ -61,7 +61,7 @@ void rf_print_component_label(RF_Compone void rf_UnconfigureVnodes( RF_Raid_t * ); void rf_close_component( RF_Raid_t *, struct vnode *, int); int rf_getdisksize(struct vnode *, RF_RaidDisk_t *); -int rf_sync_component_caches(RF_Raid_t *); +int rf_sync_component_caches(RF_Raid_t *, int); void rf_check_recon_status_ext(RF_Raid_t *, RF_ProgressInfo_t *); void rf_check_parityrewrite_status_ext(RF_Raid_t *, RF_ProgressInfo_t *); Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.389 src/sys/dev/raidframe/rf_netbsdkintf.c:1.390 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.389 Tue Aug 25 09:50:00 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Sep 27 17:39:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.389 2020/08/25 13:50:00 skrll Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.390 2020/09/27 21:39:08 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.389 2020/08/25 13:50:00 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.390 2020/09/27 21:39:08 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -1754,7 +1754,7 @@ raidioctl(dev_t dev, u_long cmd, void *d break; case DIOCCACHESYNC: - retcode = rf_sync_component_caches(raidPtr); + retcode = rf_sync_component_caches(raidPtr, *(int *)data); break; default: @@ -3661,9 +3661,8 @@ rf_get_component_caches(RF_Raid_t *raidP */ static int -rf_sync_component_cache(RF_Raid_t *raidPtr, int c) +rf_sync_component_cache(RF_Raid_t *raidPtr, int c, int force) { - int force = 1; int e = 0; for (int i = 0; i < 5; i++) { e = VOP_IOCTL(raidPtr->raid_cinfo[c].ci_vp, DIOCCACHESYNC, @@ -3677,14 +3676,14 @@ rf_sync_component_cache(RF_Raid_t *raidP } int -rf_sync_component_caches(RF_Raid_t *raidPtr) +rf_sync_component_caches(RF_Raid_t *raidPtr, int force) { int c, error; error = 0; for (c = 0; c < raidPtr->numCol; c++) { if (raidPtr->Disks[c].status == rf_ds_optimal) { - int e = rf_sync_component_cache(raidPtr, c); + int e = rf_sync_component_cache(raidPtr, c, force); if (e && !error) error = e; } @@ -3694,7 +3693,8 @@ rf_sync_component_caches(RF_Raid_t *raid int sparecol = raidPtr->numCol + c; /* Need to ensure that the reconstruct actually completed! */ if (raidPtr->Disks[sparecol].status == rf_ds_used_spare) { - int e = rf_sync_component_cache(raidPtr, sparecol); + int e = rf_sync_component_cache(raidPtr, sparecol, + force); if (e && !error) error = e; } Index: src/sys/dev/raidframe/rf_paritymap.c diff -u src/sys/dev/raidframe/rf_paritymap.c:1.9 src/sys/dev/raidframe/rf_paritymap.c:1.10 --- src/sys/dev/raidframe/rf_paritymap.c:1.9 Fri Feb 8 22:34:00 2019 +++ src/sys/dev/raidframe/rf_paritymap.c Sun Sep 27 17:39:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_paritymap.c,v 1.9 2019/02/09 03:34:00 christos Exp $ */ +/* $NetBSD: rf_paritymap.c,v 1.10 2020/09/27 21:39:08 christos Exp $ */ /*- * Copyright (c) 2009 Jed Davis. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.9 2019/02/09 03:34:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.10 2020/09/27 21:39:08 christos Exp $"); #include #include @@ -220,10 +220,10 @@ rf_paritymap_write_locked(struct rf_pari * currently have no way to express that directly.) */ if (clearing) - rf_sync_component_caches(pm->raid); + rf_sync_component_caches(pm->raid, 1); rf_paritymap_kern_write(pm->raid, pm->disk_now); if (setting) - rf_sync_component_caches(pm->raid); + rf_sync_component_caches(pm->raid, 1); } /* Mark all parity as being in need of rewrite. */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: skrll Date: Tue Aug 25 13:50:00 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.388 -r1.389 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.388 src/sys/dev/raidframe/rf_netbsdkintf.c:1.389 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.388 Fri Jul 31 20:35:33 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Aug 25 13:50:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.388 2020/07/31 20:35:33 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.389 2020/08/25 13:50:00 skrll Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.388 2020/07/31 20:35:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.389 2020/08/25 13:50:00 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -404,7 +404,7 @@ rf_autoconfig(device_t self) RF_ConfigSet_t *config_sets; if (!raidautoconfig || raidautoconfigdone == true) - return (0); + return 0; /* XXX This code can only be run once. */ raidautoconfigdone = true; @@ -787,7 +787,7 @@ raidopen(dev_t dev, int flags, int fmt, if ((rs = raidget(unit, true)) == NULL) return ENXIO; if ((error = raidlock(rs)) != 0) - return (error); + return error; if ((rs->sc_flags & RAIDF_SHUTDOWN) != 0) { error = EBUSY; @@ -818,7 +818,7 @@ raidopen(dev_t dev, int flags, int fmt, bad: raidunlock(rs); - return (error); + return error; } @@ -858,7 +858,7 @@ raidclose(dev_t dev, int flags, int fmt, dksc = &rs->sc_dksc; if ((error = raidlock(rs)) != 0) - return (error); + return error; if ((rs->sc_flags & RAIDF_INITED) != 0) { error = dk_close(dksc, dev, flags, fmt, l); @@ -879,7 +879,7 @@ raidclose(dev_t dev, int flags, int fmt, raidput(rs); } - return (error); + return error; } @@ -974,9 +974,9 @@ raidread(dev_t dev, struct uio *uio, int return ENXIO; if ((rs->sc_flags & RAIDF_INITED) == 0) - return (ENXIO); + return ENXIO; - return (physio(raidstrategy, NULL, dev, B_READ, minphys, uio)); + return physio(raidstrategy, NULL, dev, B_READ, minphys, uio); } @@ -991,9 +991,9 @@ raidwrite(dev_t dev, struct uio *uio, in return ENXIO; if ((rs->sc_flags & RAIDF_INITED) == 0) - return (ENXIO); + return ENXIO; - return (physio(raidstrategy, NULL, dev, B_WRITE, minphys, uio)); + return physio(raidstrategy, NULL, dev, B_WRITE, minphys, uio); } @@ -1742,7 +1742,7 @@ raidioctl(dev_t dev, u_long cmd, void *d } if (!raidPtr->valid) - return (EINVAL); + return EINVAL; /* * Add support for "regular" device ioctls here. @@ -1762,7 +1762,7 @@ raidioctl(dev_t dev, u_long cmd, void *d break; } - return (retcode); + return retcode; } @@ -1858,7 +1858,7 @@ rf_GetSpareTableFromDaemon(RF_SparetWait retcode = req->fcol; RF_Free(req, sizeof(*req)); /* this is not the same req as we * alloc'd */ - return (retcode); + return retcode; } #endif @@ -2043,7 +2043,7 @@ rf_DispatchKernelIO(RF_DiskQueue_t *queu } db1_printf(("Exiting from DispatchKernelIO\n")); - return (0); + return 0; } /* this is the callback function associated with a I/O invoked from kernel code. @@ -2164,7 +2164,7 @@ raidlock(struct raid_softc *rs) rs->sc_flags |= RAIDF_LOCKED; done: mutex_exit(&rs->sc_mutex); - return (error); + return error; } /* * Unlock and wake up any waiters. @@ -3577,7 +3577,7 @@ raid_detach(device_t self, int flags) return ENXIO; if ((error = raidlock(rs)) != 0) - return (error); + return error; error = raid_detach_unlocked(rs); @@ -3755,14 +3755,14 @@ rf_get_info(RF_Raid_t *raidPtr, RF_Devic int d, i, j; if (!raidPtr->valid) - return (ENODEV); + return ENODEV; config->cols = raidPtr->numCol; config->ndevs = raidPtr->numCol; if (config->ndevs >= RF_MAX_DISKS) - return (ENOMEM); + return ENOMEM; config->nspares = raidPtr->numSpare; if (config->nspares >= RF_MAX_DISKS) - return (ENOMEM); + return ENOMEM; config->maxqdepth = raidPtr->maxQueueDepth; d = 0; for (j = 0; j < config->cols; j++) {
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Fri Jul 31 20:35:34 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: no need for continue To generate a diff of this commit: cvs rdiff -u -r1.387 -r1.388 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.387 src/sys/dev/raidframe/rf_netbsdkintf.c:1.388 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.387 Fri Jul 31 16:34:38 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Jul 31 16:35:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.387 2020/07/31 20:34:38 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.388 2020/07/31 20:35:33 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.387 2020/07/31 20:34:38 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.388 2020/07/31 20:35:33 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -3697,7 +3697,6 @@ rf_sync_component_caches(RF_Raid_t *raid int e = rf_sync_component_cache(raidPtr, sparecol); if (e && !error) error = e; - continue; } } return error;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Fri Jul 31 20:34:38 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: - don't overwrite existing error. - return the error not 0 if failing. To generate a diff of this commit: cvs rdiff -u -r1.386 -r1.387 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.386 src/sys/dev/raidframe/rf_netbsdkintf.c:1.387 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.386 Fri Jul 31 15:30:09 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Jul 31 16:34:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.386 2020/07/31 19:30:09 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.387 2020/07/31 20:34:38 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.386 2020/07/31 19:30:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.387 2020/07/31 20:34:38 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -3673,7 +3673,7 @@ rf_sync_component_cache(RF_Raid_t *raidP printf("raid%d: cache flush[%d] to component %s failed (%d)\n", raidPtr->raidid, i, raidPtr->Disks[c].devname, e); } - return 0; + return e; } int @@ -3685,7 +3685,7 @@ rf_sync_component_caches(RF_Raid_t *raid for (c = 0; c < raidPtr->numCol; c++) { if (raidPtr->Disks[c].status == rf_ds_optimal) { int e = rf_sync_component_cache(raidPtr, c); - if (error == 0) + if (e && !error) error = e; } } @@ -3695,7 +3695,7 @@ rf_sync_component_caches(RF_Raid_t *raid /* Need to ensure that the reconstruct actually completed! */ if (raidPtr->Disks[sparecol].status == rf_ds_used_spare) { int e = rf_sync_component_cache(raidPtr, sparecol); - if (error == 0) + if (e && !error) error = e; continue; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Fri Jul 31 19:30:09 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Factor out the component cache flushing code; add retries. To generate a diff of this commit: cvs rdiff -u -r1.385 -r1.386 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.385 src/sys/dev/raidframe/rf_netbsdkintf.c:1.386 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.385 Sat Jun 20 14:36:27 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Jul 31 15:30:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.385 2020/06/20 18:36:27 riastradh Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.386 2020/07/31 19:30:09 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.385 2020/06/20 18:36:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.386 2020/07/31 19:30:09 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -3660,43 +3660,44 @@ rf_get_component_caches(RF_Raid_t *raidP * that fails. */ +static int +rf_sync_component_cache(RF_Raid_t *raidPtr, int c) +{ + int force = 1; + int e = 0; + for (int i = 0; i < 5; i++) { + e = VOP_IOCTL(raidPtr->raid_cinfo[c].ci_vp, DIOCCACHESYNC, + &force, FWRITE, NOCRED); + if (!e || e == ENODEV) + return e; + printf("raid%d: cache flush[%d] to component %s failed (%d)\n", + raidPtr->raidid, i, raidPtr->Disks[c].devname, e); + } + return 0; +} + int rf_sync_component_caches(RF_Raid_t *raidPtr) { - int c, sparecol; - int e,error; - int force = 1; + int c, error; error = 0; for (c = 0; c < raidPtr->numCol; c++) { if (raidPtr->Disks[c].status == rf_ds_optimal) { - e = VOP_IOCTL(raidPtr->raid_cinfo[c].ci_vp, DIOCCACHESYNC, - &force, FWRITE, NOCRED); - if (e) { -if (e != ENODEV) - printf("raid%d: cache flush to component %s failed.\n", - raidPtr->raidid, raidPtr->Disks[c].devname); -if (error == 0) { - error = e; -} - } + int e = rf_sync_component_cache(raidPtr, c); + if (error == 0) +error = e; } } - for( c = 0; c < raidPtr->numSpare ; c++) { - sparecol = raidPtr->numCol + c; + for (c = 0; c < raidPtr->numSpare ; c++) { + int sparecol = raidPtr->numCol + c; /* Need to ensure that the reconstruct actually completed! */ if (raidPtr->Disks[sparecol].status == rf_ds_used_spare) { - e = VOP_IOCTL(raidPtr->raid_cinfo[sparecol].ci_vp, - DIOCCACHESYNC, &force, FWRITE, NOCRED); - if (e) { -if (e != ENODEV) - printf("raid%d: cache flush to component %s failed.\n", - raidPtr->raidid, raidPtr->Disks[sparecol].devname); -if (error == 0) { - error = e; -} - } + int e = rf_sync_component_cache(raidPtr, sparecol); + if (error == 0) +error = e; + continue; } } return error;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: riastradh Date: Sat Jun 20 18:36:27 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.384 -r1.385 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.384 src/sys/dev/raidframe/rf_netbsdkintf.c:1.385 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.384 Fri Jun 19 19:29:39 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Jun 20 18:36:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.384 2020/06/19 19:29:39 jdolecek Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.385 2020/06/20 18:36:27 riastradh Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.384 2020/06/19 19:29:39 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.385 2020/06/20 18:36:27 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -192,7 +192,7 @@ static int raid_match(device_t, cfdata_t static void raid_attach(device_t, device_t, void *); static int raid_detach(device_t, int); -static int raidread_component_area(dev_t, struct vnode *, void *, size_t, +static int raidread_component_area(dev_t, struct vnode *, void *, size_t, daddr_t, daddr_t); static int raidwrite_component_area(dev_t, struct vnode *, void *, size_t, daddr_t, daddr_t, int); @@ -379,7 +379,7 @@ raidget(int unit, bool create) { return sc; } -static void +static void raidput(struct raid_softc *sc) { mutex_enter(&raid_lock); LIST_REMOVE(sc, sc_link); @@ -586,13 +586,13 @@ rf_buildroothack(RF_ConfigSet_t *config_ DPRINTF("%s: many roots=%d, %p\n", __func__, num_root, booted_device); - /* + /* * Maybe the MD code can help. If it cannot, then * setroot() will discover that we have no * booted_device and will ask the user if nothing was - * hardwired in the kernel config file + * hardwired in the kernel config file */ - if (booted_device == NULL) + if (booted_device == NULL) return; num_root = 0; @@ -679,7 +679,7 @@ raid_dumpblocks(device_t dev, void *va, raidPtr = &rs->sc_r; /* we only support dumping to RAID 1 sets */ - if (raidPtr->Layout.numDataCol != 1 || + if (raidPtr->Layout.numDataCol != 1 || raidPtr->Layout.numParityCol != 1) return EINVAL; @@ -688,7 +688,7 @@ raid_dumpblocks(device_t dev, void *va, /* figure out what device is alive.. */ - /* + /* Look for a component to dump to. The preference for the component to dump to is as follows: 1) the first component @@ -705,8 +705,8 @@ raid_dumpblocks(device_t dev, void *va, break; } } - - /* + + /* At this point we have possibly selected a live component. If we didn't find a live ocmponent, we now check to see if there is a relevant spared component. @@ -724,7 +724,7 @@ raid_dumpblocks(device_t dev, void *va, } } if (scol == 0) { -/* +/* We must have found a spared first component! We'll take that over anything else found so far. (We @@ -740,17 +740,17 @@ raid_dumpblocks(device_t dev, void *va, dumpto = sparecol; break; } else if (scol != -1) { -/* - Must be a spared second component. - We'll dump to that if we havn't found - anything else so far. +/* + Must be a spared second component. + We'll dump to that if we havn't found + anything else so far. */ if (dumpto == -1) dumpto = sparecol; } } } - + if (dumpto == -1) { /* we couldn't find any live components to dump to!?!? */ @@ -764,12 +764,12 @@ raid_dumpblocks(device_t dev, void *va, goto out; } - error = (*bdev->d_dump)(raidPtr->Disks[dumpto].dev, + error = (*bdev->d_dump)(raidPtr->Disks[dumpto].dev, blkno, va, nblk * raidPtr->bytesPerSector); - + out: raidunlock(rs); - + return error; } @@ -873,7 +873,7 @@ raidclose(dev_t dev, int flags, int fmt, /* free the pseudo device attach bits */ cf = device_cfdata(dksc->sc_dev); error = config_detach(dksc->sc_dev, 0); - if (error == 0) + if (error == 0) free(cf, M_RAIDFRAME); } else if (do_put) { raidput(rs); @@ -1298,7 +1298,7 @@ rf_init_component_label(RF_Raid_t *raidP raidflush_component_label(raidPtr, column); /* XXXjld what about the spares? */ } - + return 0; } @@ -1747,7 +1747,7 @@ raidioctl(dev_t dev, u_long cmd, void *d /* * Add support for "regular" device ioctls here. */ - + switch (cmd) { case DIOCGCACHE: retcode = rf_get_component_caches(raidPtr, (int *)data); @@ -202
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: jdolecek Date: Fri Jun 19 19:32:03 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_diskqueue.c Log Message: remove unnnecessary splbio() in rf_FreeDiskQueueData() To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/dev/raidframe/rf_diskqueue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.57 src/sys/dev/raidframe/rf_diskqueue.c:1.58 --- src/sys/dev/raidframe/rf_diskqueue.c:1.57 Fri Jun 19 19:29:39 2020 +++ src/sys/dev/raidframe/rf_diskqueue.c Fri Jun 19 19:32:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $"); #include @@ -405,9 +405,6 @@ rf_CreateDiskQueueData(RF_IoType_t typ, void rf_FreeDiskQueueData(RF_DiskQueueData_t *p) { - int s; - s = splbio(); /* XXX protect only pool_put, or neither? */ putiobuf(p->bp); pool_put(&rf_pools.dqd, p); - splx(s); }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: jdolecek Date: Fri Jun 19 19:29:39 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_dag.h rf_dagfuncs.c rf_diskqueue.c rf_diskqueue.h rf_netbsd.h rf_netbsdkintf.c Log Message: pass down b_flags B_PHYS|B_RAW|B_MEDIA_FLAGS from bio subsystem to component I/O fixes the xbd(4) KASSERT() triggered by raidframe, noted in PR kern/55397 by Frank Kardel To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_dag.h cvs rdiff -u -r1.31 -r1.32 src/sys/dev/raidframe/rf_dagfuncs.c cvs rdiff -u -r1.56 -r1.57 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_diskqueue.h cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_netbsd.h cvs rdiff -u -r1.383 -r1.384 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_dag.h diff -u src/sys/dev/raidframe/rf_dag.h:1.20 src/sys/dev/raidframe/rf_dag.h:1.21 --- src/sys/dev/raidframe/rf_dag.h:1.20 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/rf_dag.h Fri Jun 19 19:29:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dag.h,v 1.20 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: rf_dag.h,v 1.21 2020/06/19 19:29:39 jdolecek Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -178,7 +178,7 @@ struct RF_DagHeader_s { RF_Raid_t *raidPtr; /* the descriptor for the RAID device this DAG * is for */ RF_RaidAccessDesc_t *desc; /* ptr to descriptor for this access */ - void *bp; /* the bp for this I/O passed down from the + const struct buf *bp; /* the bp for this I/O passed down from the * file system. ignored outside kernel */ }; Index: src/sys/dev/raidframe/rf_dagfuncs.c diff -u src/sys/dev/raidframe/rf_dagfuncs.c:1.31 src/sys/dev/raidframe/rf_dagfuncs.c:1.32 --- src/sys/dev/raidframe/rf_dagfuncs.c:1.31 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/rf_dagfuncs.c Fri Jun 19 19:29:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagfuncs.c,v 1.31 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.31 2019/10/10 03:43:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $"); #include #include @@ -272,10 +272,6 @@ rf_DiskReadFuncForThreads(RF_DagNode_t * unsigned which_ru = RF_EXTRACT_RU(node->params[3].v); RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_READ : RF_IO_TYPE_NOP; RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; - void *b_proc = NULL; - - if (node->dagHdr->bp) - b_proc = (void *) ((struct buf *) node->dagHdr->bp)->b_proc; req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector, bf, parityStripeID, which_ru, node->wakeFunc, node, @@ -284,7 +280,7 @@ rf_DiskReadFuncForThreads(RF_DagNode_t * #else NULL, #endif - (void *) (node->dagHdr->raidPtr), 0, b_proc, PR_NOWAIT); + (void *) (node->dagHdr->raidPtr), 0, node->dagHdr->bp, PR_NOWAIT); if (!req) { (node->wakeFunc) (node, ENOMEM); } else { @@ -308,10 +304,6 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t unsigned which_ru = RF_EXTRACT_RU(node->params[3].v); RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_WRITE : RF_IO_TYPE_NOP; RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues; - void *b_proc = NULL; - - if (node->dagHdr->bp) - b_proc = (void *) ((struct buf *) node->dagHdr->bp)->b_proc; /* normal processing (rollaway or forward recovery) begins here */ req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector, @@ -322,7 +314,7 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t NULL, #endif (void *) (node->dagHdr->raidPtr), - 0, b_proc, PR_NOWAIT); + 0, node->dagHdr->bp, PR_NOWAIT); if (!req) { (node->wakeFunc) (node, ENOMEM); Index: src/sys/dev/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.56 src/sys/dev/raidframe/rf_diskqueue.c:1.57 --- src/sys/dev/raidframe/rf_diskqueue.c:1.56 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/rf_diskqueue.c Fri Jun 19 19:29:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.56 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.56 2019/10/10 03:43:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $"); #include @@ -
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Tue Jun 16 14:45:08 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Improve wording in comments in raid_dumpblock(). To generate a diff of this commit: cvs rdiff -u -r1.382 -r1.383 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.382 src/sys/dev/raidframe/rf_netbsdkintf.c:1.383 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.382 Mon Apr 13 00:27:17 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Jun 16 14:45:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.382 2020/04/13 00:27:17 chs Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.383 2020/06/16 14:45:08 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.382 2020/04/13 00:27:17 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.383 2020/06/16 14:45:08 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -689,10 +689,10 @@ raid_dumpblocks(device_t dev, void *va, /* Look for a component to dump to. The preference for the component to dump to is as follows: - 1) the master - 2) a used_spare of the master - 3) the slave - 4) a used_spare of the slave + 1) the first component + 2) a used_spare of the first component + 3) the second component + 4) a used_spare of the second component */ dumpto = -1; @@ -705,10 +705,9 @@ raid_dumpblocks(device_t dev, void *va, } /* - At this point we have possibly selected a live master or a - live slave. We now check to see if there is a spared - master (or a spared slave), if we didn't find a live master - or a live slave. + At this point we have possibly selected a live component. + If we didn't find a live ocmponent, we now check to see + if there is a relevant spared component. */ for (c = 0; c < raidPtr->numSpare; c++) { @@ -724,24 +723,25 @@ raid_dumpblocks(device_t dev, void *va, } if (scol == 0) { /* - We must have found a spared master! - We'll take that over anything else - found so far. (We couldn't have - found a real master before, since - this is a used spare, and it's - saying that it's replacing the - master.) On reboot (with + We must have found a spared first + component! We'll take that over + anything else found so far. (We + couldn't have found a real first + component before, since this is a + used spare, and it's saying that + it's replacing the first + component.) On reboot (with autoconfiguration turned on) - sparecol will become the 1st - component (component0) of this set. + sparecol will become the first + component (component0) of this set. */ dumpto = sparecol; break; } else if (scol != -1) { /* - Must be a spared slave. We'll dump - to that if we havn't found anything - else so far. + Must be a spared second component. + We'll dump to that if we havn't found + anything else so far. */ if (dumpto == -1) dumpto = sparecol;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: riastradh Date: Sat Mar 21 06:02:13 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Restore historic $Hdr: ...$ text. This was presumably eaten by git cvsexportcommit, which is curious because I thought I had gotten out of the habit of passing -k to it. To generate a diff of this commit: cvs rdiff -u -r1.380 -r1.381 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.380 src/sys/dev/raidframe/rf_netbsdkintf.c:1.381 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.380 Sun Mar 1 03:21:54 2020 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Mar 21 06:02:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.380 2020/03/01 03:21:54 riastradh Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.381 2020/03/21 06:02:13 riastradh Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: Utah $Hdr$ + * from: Utah $Hdr: cd.c 1.6 90/11/28$ * * @(#)cd.c8.2 (Berkeley) 11/16/93 */ @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.380 2020/03/01 03:21:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.381 2020/03/21 06:02:13 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h"
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: maxv Date: Tue Jan 7 06:10:19 UTC 2020 Modified Files: src/sys/dev/raidframe: rf_compat32.c Log Message: Fix big bugs. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/raidframe/rf_compat32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_compat32.c diff -u src/sys/dev/raidframe/rf_compat32.c:1.7 src/sys/dev/raidframe/rf_compat32.c:1.8 --- src/sys/dev/raidframe/rf_compat32.c:1.7 Thu Dec 12 02:15:43 2019 +++ src/sys/dev/raidframe/rf_compat32.c Tue Jan 7 06:10:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat32.c,v 1.7 2019/12/12 02:15:43 pgoyette Exp $ */ +/* $NetBSD: rf_compat32.c,v 1.8 2020/01/07 06:10:18 maxv Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -101,7 +101,7 @@ rf_config_netbsd32(struct raid_softc *rs k_cfg = RF_Malloc(sizeof(*k_cfg)); if (k_cfg == NULL) { RF_Free(k_cfg32, sizeof(RF_Config_t32)); - RF_Free(k_cfg, sizeof(RF_Config_t)); + return ENOMEM; } k_cfg->numCol = k_cfg32->numCol; k_cfg->numSpare = k_cfg32->numSpare;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: hannken Date: Wed Feb 20 10:04:28 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Fix vnode locking, must lock for VOP_OPEN() and VOP_UNLOCK() when done. To generate a diff of this commit: cvs rdiff -u -r1.374 -r1.375 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.374 src/sys/dev/raidframe/rf_netbsdkintf.c:1.375 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.374 Sat Feb 9 03:34:00 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Feb 20 10:04:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.374 2019/02/09 03:34:00 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.375 2019/02/20 10:04:28 hannken Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.374 2019/02/09 03:34:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.375 2019/02/20 10:04:28 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -2838,6 +2838,7 @@ rf_find_raid_components(void) if (bdevvp(dev, &vp)) panic("RAID can't alloc vnode"); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED); if (error) { @@ -2858,7 +2859,6 @@ rf_find_raid_components(void) printf("RAIDframe: can't get disk size" " for dev %s (%d)\n", device_xname(dv), error); -vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); VOP_CLOSE(vp, FREAD | FWRITE, NOCRED); vput(vp); continue; @@ -2870,19 +2870,18 @@ rf_find_raid_components(void) if (error) { printf("RAIDframe: can't get wedge info for " "dev %s (%d)\n", device_xname(dv), error); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); VOP_CLOSE(vp, FREAD | FWRITE, NOCRED); vput(vp); continue; } if (strcmp(dkw.dkw_ptype, DKW_PTYPE_RAIDFRAME) != 0) { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); VOP_CLOSE(vp, FREAD | FWRITE, NOCRED); vput(vp); continue; } +VOP_UNLOCK(vp); ac_list = rf_get_component(ac_list, dev, vp, device_xname(dv), dkw.dkw_size, numsecs, secsize); rf_part_found = 1; /*There is a raid component on this disk*/ @@ -2903,7 +2902,6 @@ rf_find_raid_components(void) /* don't need this any more. We'll allocate it again a little later if we really do... */ - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); VOP_CLOSE(vp, FREAD | FWRITE, NOCRED); vput(vp); @@ -2922,12 +2920,14 @@ rf_find_raid_components(void) if (bdevvp(dev, &vp)) panic("RAID can't alloc vnode"); +vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_OPEN(vp, FREAD, NOCRED); if (error) { /* Whatever... */ vput(vp); continue; } +VOP_UNLOCK(vp); snprintf(cname, sizeof(cname), "%s%c", device_xname(dv), 'a' + i); ac_list = rf_get_component(ac_list, dev, vp, cname, @@ -2949,12 +2949,15 @@ rf_find_raid_components(void) if (bdevvp(dev, &vp)) panic("RAID can't alloc vnode"); +vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + error = VOP_OPEN(vp, FREAD, NOCRED); if (error) { /* Whatever... */ vput(vp); continue; } +VOP_UNLOCK(vp); snprintf(cname, sizeof(cname), "%s%c", device_xname(dv), 'a' + RAW_PART); ac_list = rf_get_component(ac_list, dev, vp, cname,
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Sat Feb 9 03:34:00 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_alloclist.c rf_chaindecluster.c rf_compat32.c rf_compat50.c rf_compat80.c rf_copyback.c rf_cvscan.c rf_dagdegrd.c rf_dagdegwr.c rf_dagffwr.c rf_dagutils.c rf_debugMem.c rf_debugMem.h rf_decluster.c rf_declusterPQ.c rf_diskqueue.c rf_disks.c rf_driver.c rf_evenodd.c rf_evenodd_dagfuncs.c rf_fifo.c rf_interdecluster.c rf_map.c rf_netbsdkintf.c rf_paritylog.c rf_paritylogDiskMgr.c rf_paritylogging.c rf_parityloggingdags.c rf_paritymap.c rf_parityscan.c rf_psstatus.c rf_raid0.c rf_raid1.c rf_raid4.c rf_raid5.c rf_raid5_rotatedspare.c rf_reconmap.c rf_reconstruct.c rf_reconutil.c rf_sstf.c rf_stripelocks.c rf_utils.c Log Message: - Change the allocation macros to be more like function calls - Change sizeof(type) -> sizeof(*variable) - Use macros for the long buffer length allocations - Remove "bit polishing" memsets() -- do them only once - Remove unnecessary casts Thanks to oster@ for finding bugs and testing. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/raidframe/rf_alloclist.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/raidframe/rf_chaindecluster.c \ src/sys/dev/raidframe/rf_fifo.c src/sys/dev/raidframe/rf_raid0.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/raidframe/rf_compat32.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/raidframe/rf_compat50.c \ src/sys/dev/raidframe/rf_paritymap.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/raidframe/rf_compat80.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/raidframe/rf_copyback.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_cvscan.c \ src/sys/dev/raidframe/rf_declusterPQ.c src/sys/dev/raidframe/rf_sstf.c \ src/sys/dev/raidframe/rf_utils.c cvs rdiff -u -r1.29 -r1.30 src/sys/dev/raidframe/rf_dagdegrd.c cvs rdiff -u -r1.33 -r1.34 src/sys/dev/raidframe/rf_dagdegwr.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_dagffwr.c \ src/sys/dev/raidframe/rf_paritylogging.c \ src/sys/dev/raidframe/rf_parityscan.c src/sys/dev/raidframe/rf_psstatus.c cvs rdiff -u -r1.54 -r1.55 src/sys/dev/raidframe/rf_dagutils.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_debugMem.c \ src/sys/dev/raidframe/rf_evenodd.c \ src/sys/dev/raidframe/rf_parityloggingdags.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/raidframe/rf_debugMem.h \ src/sys/dev/raidframe/rf_raid5_rotatedspare.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_decluster.c cvs rdiff -u -r1.53 -r1.54 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.90 -r1.91 src/sys/dev/raidframe/rf_disks.c cvs rdiff -u -r1.134 -r1.135 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/raidframe/rf_evenodd_dagfuncs.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/raidframe/rf_interdecluster.c cvs rdiff -u -r1.47 -r1.48 src/sys/dev/raidframe/rf_map.c cvs rdiff -u -r1.373 -r1.374 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/raidframe/rf_paritylog.c cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_paritylogDiskMgr.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_raid1.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/raidframe/rf_raid4.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/rf_raid5.c cvs rdiff -u -r1.36 -r1.37 src/sys/dev/raidframe/rf_reconmap.c \ src/sys/dev/raidframe/rf_reconutil.c cvs rdiff -u -r1.121 -r1.122 src/sys/dev/raidframe/rf_reconstruct.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/raidframe/rf_stripelocks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_alloclist.c diff -u src/sys/dev/raidframe/rf_alloclist.c:1.26 src/sys/dev/raidframe/rf_alloclist.c:1.27 --- src/sys/dev/raidframe/rf_alloclist.c:1.26 Sun Mar 15 13:17:23 2009 +++ src/sys/dev/raidframe/rf_alloclist.c Fri Feb 8 22:33:59 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_alloclist.c,v 1.26 2009/03/15 17:17:23 cegger Exp $ */ +/* $NetBSD: rf_alloclist.c,v 1.27 2019/02/09 03:33:59 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.26 2009/03/15 17:17:23 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.27 2019/02/09 03:33:59 christos Exp $"); #include @@ -125,6 +125,6 @@ rf_real_MakeAllocList(void) RF_AllocListElem_t *p; p = pool_get(&rf_pools.alloclist, PR_WAITOK); - memset((char *) p, 0, sizeof(RF_AllocListElem_t)); + memset(p, 0, sizeof(*p)); return (p); } Index: src/sys/dev/raidframe/rf_chaindecluster.c diff -u src/sys/dev/raidframe/rf_chaindecluster.c:1.15 src/sys/dev/raidframe/rf_chaindecluster.c:1.16 --- src/sys/dev/raidframe/rf_chaindecluster.c:1.15 Wed Nov 15 20:33:23
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Fri Feb 8 13:37:46 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_disks.c Log Message: PR/53956: Havard Eidnes: raidframe fails to create raid set on disks. The test to check if force was reversed when the code was factored out. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/dev/raidframe/rf_disks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_disks.c diff -u src/sys/dev/raidframe/rf_disks.c:1.89 src/sys/dev/raidframe/rf_disks.c:1.90 --- src/sys/dev/raidframe/rf_disks.c:1.89 Fri Jan 13 08:01:13 2017 +++ src/sys/dev/raidframe/rf_disks.c Fri Feb 8 08:37:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.89 2017/01/13 13:01:13 christos Exp $ */ +/* $NetBSD: rf_disks.c,v 1.90 2019/02/08 13:37:46 christos Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -60,7 +60,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.89 2017/01/13 13:01:13 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.90 2019/02/08 13:37:46 christos Exp $"); #include @@ -705,7 +705,7 @@ rf_handle_hosed(RF_Raid_t *raidPtr, RF_C int again) { printf("Hosed component: %s\n", &cfgPtr->devnames[0][hosed_column][0]); - if (!cfgPtr->force) + if (cfgPtr->force) return; /* we'll fail this component, as if there are
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Thu Feb 7 03:03:00 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: You need a star :-) To generate a diff of this commit: cvs rdiff -u -r1.372 -r1.373 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.372 src/sys/dev/raidframe/rf_netbsdkintf.c:1.373 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.372 Wed Feb 6 18:00:16 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Feb 6 22:03:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.372 2019/02/06 23:00:16 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.373 2019/02/07 03:03:00 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.372 2019/02/06 23:00:16 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.373 2019/02/07 03:03:00 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -1167,7 +1167,7 @@ rf_getConfiguration(struct raid_softc *r if (*k_cfg == NULL) { return ENOMEM; } - int retcode = copyin(u_cfg, k_cfg, sizeof(RF_Config_t)); + int retcode = copyin(u_cfg, *k_cfg, sizeof(RF_Config_t)); if (retcode == 0) return 0; RF_Free(*k_cfg, sizeof(RF_Config_t));
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Feb 6 23:00:16 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: - Restore indirecting through the data pointer - Don't try to load compat code if the ioctl is not for us. To generate a diff of this commit: cvs rdiff -u -r1.371 -r1.372 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.371 src/sys/dev/raidframe/rf_netbsdkintf.c:1.372 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.371 Tue Feb 5 22:37:13 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Feb 6 18:00:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.371 2019/02/06 03:37:13 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.372 2019/02/06 23:00:16 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.371 2019/02/06 03:37:13 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.372 2019/02/06 23:00:16 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -1153,6 +1153,8 @@ rf_copyinspecificbuf(RF_Config_t *k_cfg) static int rf_getConfiguration(struct raid_softc *rs, void *data, RF_Config_t **k_cfg) { + RF_Config_t *u_cfg = *((RF_Config_t **) data); + if (rs->sc_r.valid) { /* There is a valid RAID set running on this unit! */ printf("raid%d: Device already configured!\n", rs->sc_unit); @@ -1165,7 +1167,7 @@ rf_getConfiguration(struct raid_softc *r if (*k_cfg == NULL) { return ENOMEM; } - int retcode = copyin(data, k_cfg, sizeof(RF_Config_t)); + int retcode = copyin(u_cfg, k_cfg, sizeof(RF_Config_t)); if (retcode == 0) return 0; RF_Free(*k_cfg, sizeof(RF_Config_t)); @@ -1707,6 +1709,13 @@ raidioctl(dev_t dev, u_long cmd, void *d return retcode; #endif default: + /* + * Don't bother trying to load compat modules + * if it is not our ioctl. This is more efficient + * and makes rump tests not depend on compat code + */ + if (IOCGROUP(cmd) != 'r') + break; #ifdef _LP64 if ((l->l_proc->p_flag & PK_32) != 0) { module_autoload("compat_netbsd32_raid",
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Feb 6 15:39:41 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_compat32.c Log Message: fix half edited line. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/raidframe/rf_compat32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_compat32.c diff -u src/sys/dev/raidframe/rf_compat32.c:1.3 src/sys/dev/raidframe/rf_compat32.c:1.4 --- src/sys/dev/raidframe/rf_compat32.c:1.3 Tue Feb 5 18:28:02 2019 +++ src/sys/dev/raidframe/rf_compat32.c Wed Feb 6 10:39:41 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat32.c,v 1.3 2019/02/05 23:28:02 christos Exp $ */ +/* $NetBSD: rf_compat32.c,v 1.4 2019/02/06 15:39:41 christos Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -152,7 +152,7 @@ raidframe_netbsd32_ioctl(struct raid_sof switch (cmd) { case RAIDFRAME_GET_INFO32: - if (!rf_inited(rs) == 0) + if (!rf_inited(rs)) return ENXIO; return rf_get_info_netbsd32(raidPtr, data); case RAIDFRAME_CONFIGURE32:
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Wed Feb 6 03:37:13 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Fix GET_INFO. Yes, can probably be simplified. To generate a diff of this commit: cvs rdiff -u -r1.370 -r1.371 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.370 src/sys/dev/raidframe/rf_netbsdkintf.c:1.371 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.370 Wed Feb 6 03:01:48 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Feb 6 03:37:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.370 2019/02/06 03:01:48 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.371 2019/02/06 03:37:13 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.370 2019/02/06 03:01:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.371 2019/02/06 03:37:13 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -1399,7 +1399,7 @@ raidioctl(dev_t dev, u_long cmd, void *d RF_Raid_t *raidPtr; RF_AccTotals_t *totals; RF_SingleComponent_t component; - RF_DeviceConfig_t *d_cfg; + RF_DeviceConfig_t *d_cfg, *ucfgp; int retcode = 0; int column; RF_ComponentLabel_t *clabel; @@ -1513,13 +1513,14 @@ raidioctl(dev_t dev, u_long cmd, void *d return rf_rebuild_in_place(raidPtr, data); case RAIDFRAME_GET_INFO: + ucfgp = *(RF_DeviceConfig_t **)data; RF_Malloc(d_cfg, sizeof(RF_DeviceConfig_t), (RF_DeviceConfig_t *)); if (d_cfg == NULL) return ENOMEM; retcode = rf_get_info(raidPtr, d_cfg); if (retcode == 0) { - retcode = copyout(d_cfg, data, sizeof(*d_cfg)); + retcode = copyout(d_cfg, ucfgp, sizeof(*d_cfg)); } RF_Free(d_cfg, sizeof(RF_DeviceConfig_t)); return retcode;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Feb 6 03:01:49 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: use 'data' directly. To generate a diff of this commit: cvs rdiff -u -r1.369 -r1.370 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.369 src/sys/dev/raidframe/rf_netbsdkintf.c:1.370 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.369 Tue Feb 5 21:49:50 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Feb 5 22:01:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.369 2019/02/06 02:49:50 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.370 2019/02/06 03:01:48 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.369 2019/02/06 02:49:50 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.370 2019/02/06 03:01:48 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -1399,7 +1399,7 @@ raidioctl(dev_t dev, u_long cmd, void *d RF_Raid_t *raidPtr; RF_AccTotals_t *totals; RF_SingleComponent_t component; - RF_DeviceConfig_t *d_cfg, *ucfgp = data; + RF_DeviceConfig_t *d_cfg; int retcode = 0; int column; RF_ComponentLabel_t *clabel; @@ -1519,7 +1519,7 @@ raidioctl(dev_t dev, u_long cmd, void *d return ENOMEM; retcode = rf_get_info(raidPtr, d_cfg); if (retcode == 0) { - retcode = copyout(d_cfg, ucfgp, sizeof(*d_cfg)); + retcode = copyout(d_cfg, data, sizeof(*d_cfg)); } RF_Free(d_cfg, sizeof(RF_DeviceConfig_t)); return retcode;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Wed Feb 6 02:49:51 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Fix logic inversion. Progress, but still broken. To generate a diff of this commit: cvs rdiff -u -r1.368 -r1.369 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.368 src/sys/dev/raidframe/rf_netbsdkintf.c:1.369 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.368 Wed Feb 6 02:49:09 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Feb 6 02:49:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.368 2019/02/06 02:49:09 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.369 2019/02/06 02:49:50 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.368 2019/02/06 02:49:09 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.369 2019/02/06 02:49:50 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -1067,7 +1067,7 @@ rf_must_be_initialized(const struct raid case RAIDFRAME_SET_AUTOCONFIG: case RAIDFRAME_SET_COMPONENT_LABEL: case RAIDFRAME_SET_ROOT: - return (rs->sc_flags & RAIDF_INITED) != 0; + return (rs->sc_flags & RAIDF_INITED) == 0; } return false; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Wed Feb 6 02:49:09 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsd.h rf_netbsdkintf.c rf_raid.h Log Message: Shuffle softc declarations to a different .h file. Create missing rf_get_raid(). Things compile, but don't work correctly. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/raidframe/rf_netbsd.h cvs rdiff -u -r1.367 -r1.368 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/raidframe/rf_raid.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsd.h diff -u src/sys/dev/raidframe/rf_netbsd.h:1.32 src/sys/dev/raidframe/rf_netbsd.h:1.33 --- src/sys/dev/raidframe/rf_netbsd.h:1.32 Tue Feb 5 23:28:02 2019 +++ src/sys/dev/raidframe/rf_netbsd.h Wed Feb 6 02:49:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.32 2019/02/05 23:28:02 christos Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.33 2019/02/06 02:49:09 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -103,11 +103,4 @@ typedef struct RF_ConfigSet_s { struct RF_ConfigSet_s *next; } RF_ConfigSet_t; -int rf_fail_disk(RF_Raid_t *, struct rf_recon_req *); - -int rf_inited(const struct raid_softc *); -int rf_get_unit(const struct raid_softc *); -RF_Raid_t *rf_get_raid(struct raid_softc *); -int rf_construct(struct raid_softc *, RF_Config_t *); - #endif /* _RF__RF_NETBSDSTUFF_H_ */ Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.367 src/sys/dev/raidframe/rf_netbsdkintf.c:1.368 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.367 Tue Feb 5 23:28:02 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Feb 6 02:49:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.367 2019/02/05 23:28:02 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.368 2019/02/06 02:49:09 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.367 2019/02/05 23:28:02 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.368 2019/02/06 02:49:09 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -182,7 +182,6 @@ static void KernelWakeupFunc(struct buf static void InitBP(struct buf *, struct vnode *, unsigned, dev_t, RF_SectorNum_t, RF_SectorCount_t, void *, void (*) (struct buf *), void *, int, struct proc *); -struct raid_softc; static void raidinit(struct raid_softc *); static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp); static int rf_get_component_caches(RF_Raid_t *raidPtr, int *); @@ -250,26 +249,6 @@ static struct dkdriver rf_dkdriver = { .d_minphys = minphys }; -struct raid_softc { - struct dk_softc sc_dksc; - int sc_unit; - int sc_flags; /* flags */ - int sc_cflags; /* configuration flags */ - kmutex_t sc_mutex; /* interlock mutex */ - kcondvar_t sc_cv; /* and the condvar */ - uint64_t sc_size; /* size of the raid device */ - charsc_xname[20]; /* XXX external name */ - RF_Raid_t sc_r; - LIST_ENTRY(raid_softc) sc_link; -}; -/* sc_flags */ -#define RAIDF_INITED 0x01 /* unit has been initialized */ -#define RAIDF_SHUTDOWN 0x02 /* unit is being shutdown */ -#define RAIDF_DETACH 0x04 /* detach after final close */ -#define RAIDF_WANTED 0x08 /* someone waiting to obtain a lock */ -#define RAIDF_LOCKED 0x10 /* unit is locked */ -#define RAIDF_UNIT_CHANGED 0x20 /* unit is being changed */ - #define raidunit(x) DISKUNIT(x) #define raidsoftc(dev) (((struct raid_softc *)device_private(dev))->sc_r.softc) @@ -460,6 +439,11 @@ rf_inited(const struct raid_softc *rs) { return (rs->sc_flags & RAIDF_INITED) != 0; } +RF_Raid_t * +rf_get_raid(struct raid_softc *rs) { + return &rs->sc_r; +} + int rf_get_unit(const struct raid_softc *rs) { return rs->sc_unit; Index: src/sys/dev/raidframe/rf_raid.h diff -u src/sys/dev/raidframe/rf_raid.h:1.46 src/sys/dev/raidframe/rf_raid.h:1.47 --- src/sys/dev/raidframe/rf_raid.h:1.46 Tue Jan 8 07:18:18 2019 +++ src/sys/dev/raidframe/rf_raid.h Wed Feb 6 02:49:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid.h,v 1.46 2019/01/08 07:18:18 mrg Exp $ */ +/* $NetBSD: rf_raid.h,v 1.47 2019/02/06 02:49:09 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -305,4 +305,33 @@ struct RF_Raid_s { #endif/* RF_INCLUDE_PARITYLOGGING > 0 */ struct rf_paritymap *parity_map; }; + +struct raid_softc { + struct dk_softc sc_dksc; + int sc_unit; + int sc_flags; /* flags */ + int sc_cflags; /* configuration flags */ + kmutex_t sc_mutex; /* interlock mutex */ + kcondvar_t sc_cv; /* and the condvar */ + uint64_t sc_size; /* size of the raid device */ + charsc_xname[20]; /* XXX external name */ + RF_Raid_t sc_r; + LIST_
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Tue Feb 5 19:42:31 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_compat80.c Log Message: use -> instead of . To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_compat80.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_compat80.c diff -u src/sys/dev/raidframe/rf_compat80.c:1.9 src/sys/dev/raidframe/rf_compat80.c:1.10 --- src/sys/dev/raidframe/rf_compat80.c:1.9 Tue Feb 5 12:13:37 2019 +++ src/sys/dev/raidframe/rf_compat80.c Tue Feb 5 14:42:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80.c,v 1.9 2019/02/05 17:13:37 christos Exp $ */ +/* $NetBSD: rf_compat80.c,v 1.10 2019/02/05 19:42:31 christos Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -226,8 +226,8 @@ static int rf_fail_disk80(RF_Raid_t *raidPtr, struct rf_recon_req80 *req80) { struct rf_recon_req req = { - .col = req80.col, - .flags = req80.flags, + .col = req80->col, + .flags = req80->flags, }; return rf_fail_disk(raidPtr, &req); }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Tue Feb 5 17:13:37 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_compat80.c rf_netbsd.h rf_netbsdkintf.c Log Message: - Fix the FAIL_DISK handling (it would prolly trash the wrong disk before since the request structs are different and the row in the old struct is the col in the new one). - Restructure the way compat modules are loaded so that we only load them for the ioctls that need them. Put a comment explaining why... - Set retcode after loading compat (now that the fail disk passthrough hack is gone), so that various ioctls don't always fail. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/raidframe/rf_compat80.c cvs rdiff -u -r1.30 -r1.31 src/sys/dev/raidframe/rf_netbsd.h cvs rdiff -u -r1.365 -r1.366 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_compat80.c diff -u src/sys/dev/raidframe/rf_compat80.c:1.8 src/sys/dev/raidframe/rf_compat80.c:1.9 --- src/sys/dev/raidframe/rf_compat80.c:1.8 Sun Feb 3 03:02:24 2019 +++ src/sys/dev/raidframe/rf_compat80.c Tue Feb 5 12:13:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80.c,v 1.8 2019/02/03 08:02:24 pgoyette Exp $ */ +/* $NetBSD: rf_compat80.c,v 1.9 2019/02/05 17:13:37 christos Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -222,6 +222,16 @@ rf_config80(RF_Raid_t *raidPtr, int unit return 0; } +static int +rf_fail_disk80(RF_Raid_t *raidPtr, struct rf_recon_req80 *req80) +{ + struct rf_recon_req req = { + .col = req80.col, + .flags = req80.flags, + }; + return rf_fail_disk(raidPtr, &req); +} + int raidframe_ioctl_80(u_long cmd, int initted, RF_Raid_t *raidPtr, int unit, void *data, RF_Config_t **k_cfg) @@ -238,9 +248,8 @@ raidframe_ioctl_80(u_long cmd, int initt return ENXIO; break; case RAIDFRAME_CONFIGURE80: - break; case RAIDFRAME_FAIL_DISK80: - return EPASSTHROUGH; + break; default: return EPASSTHROUGH; } @@ -261,8 +270,12 @@ raidframe_ioctl_80(u_long cmd, int initt if (error != 0) return error; return EAGAIN; /* flag mainline to call generic config */ + case RAIDFRAME_FAIL_DISK80: + return rf_fail_disk80(raidPtr, data); + default: + /* abort really */ + return EPASSTHROUGH; } - return EPASSTHROUGH; } static void Index: src/sys/dev/raidframe/rf_netbsd.h diff -u src/sys/dev/raidframe/rf_netbsd.h:1.30 src/sys/dev/raidframe/rf_netbsd.h:1.31 --- src/sys/dev/raidframe/rf_netbsd.h:1.30 Sat Apr 27 17:18:42 2013 +++ src/sys/dev/raidframe/rf_netbsd.h Tue Feb 5 12:13:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.30 2013/04/27 21:18:42 christos Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.31 2019/02/05 17:13:37 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -103,4 +103,6 @@ typedef struct RF_ConfigSet_s { struct RF_ConfigSet_s *next; } RF_ConfigSet_t; +int rf_fail_disk(RF_Raid_t *, struct rf_recon_req *); + #endif /* _RF__RF_NETBSDSTUFF_H_ */ Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.365 src/sys/dev/raidframe/rf_netbsdkintf.c:1.366 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.365 Tue Feb 5 04:45:38 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Feb 5 12:13:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.365 2019/02/05 09:45:38 mrg Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.366 2019/02/05 17:13:37 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.365 2019/02/05 09:45:38 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.366 2019/02/05 17:13:37 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -149,6 +149,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkin #include "rf_parityscan.h" #include "rf_threadstuff.h" +#include "rf_compat50.h" #include "rf_compat80.h" #ifdef COMPAT_NETBSD32 @@ -1049,6 +1050,145 @@ raid_detach_unlocked(struct raid_softc * return 0; } +static bool +rf_must_be_initialized(const struct raid_softc *rs, u_long cmd) +{ + switch (cmd) { + case RAIDFRAME_ADD_HOT_SPARE: + case RAIDFRAME_CHECK_COPYBACK_STATUS: + case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT: + case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT80: + case RAIDFRAME_CHECK_PARITY: + case RAIDFRAME_CHECK_PARITYREWRITE_STATUS: + case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT: + case RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT80: + case RAIDFRAME_CHECK_RECON_STATUS: + case RAIDFRAME_CHECK_RECON_STATUS_EXT: + case RAIDFRAME_CHECK_RECON_STATUS_EXT80: + case RAIDFRAME_COPYBACK: + case RAIDFRAME_DELETE_COMPONENT: + case RAIDFRAME_FAIL_DISK: + case RAIDFRAME_FAIL_DISK80: + case RAIDFRAME_GET_ACCTOTALS: + case RAIDFRAME_GET_COMPON
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Tue Feb 5 09:45:38 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: remove duplicated line in previously. noticed by paulg. To generate a diff of this commit: cvs rdiff -u -r1.364 -r1.365 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.364 src/sys/dev/raidframe/rf_netbsdkintf.c:1.365 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.364 Tue Feb 5 09:28:00 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Feb 5 09:45:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.364 2019/02/05 09:28:00 mrg Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.365 2019/02/05 09:45:38 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.364 2019/02/05 09:28:00 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.365 2019/02/05 09:45:38 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -155,7 +155,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkin #ifdef _LP64 #include "rf_compat32.h" #define RAID_COMPAT32 -#define RAID_COMPAT32 #endif #endif
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Tue Feb 5 09:28:00 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: fix the previous: rf_netbsd32 is only relevant on _LP64 as all the structures are the same for arm32 oabi/eabi compat. only do it for _LP64 *and* COMAPT_NETBSD32. To generate a diff of this commit: cvs rdiff -u -r1.363 -r1.364 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.363 src/sys/dev/raidframe/rf_netbsdkintf.c:1.364 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.363 Mon Feb 4 21:57:47 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Feb 5 09:28:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.363 2019/02/04 21:57:47 mrg Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.364 2019/02/05 09:28:00 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.363 2019/02/04 21:57:47 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.364 2019/02/05 09:28:00 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -152,7 +152,11 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkin #include "rf_compat80.h" #ifdef COMPAT_NETBSD32 +#ifdef _LP64 #include "rf_compat32.h" +#define RAID_COMPAT32 +#define RAID_COMPAT32 +#endif #endif #include "ioconf.h" @@ -1110,7 +1114,7 @@ raidioctl(dev_t dev, u_long cmd, void *d case RAIDFRAME_PARITYMAP_GET_DISABLE: case RAIDFRAME_PARITYMAP_SET_DISABLE: case RAIDFRAME_PARITYMAP_SET_PARAMS: -#ifdef COMPAT_NETBSD32 +#ifdef RAID_COMPAT32 case RAIDFRAME_GET_INFO32: #endif if ((rs->sc_flags & RAIDF_INITED) == 0) @@ -1160,7 +1164,7 @@ raidioctl(dev_t dev, u_long cmd, void *d /* configure the system */ case RAIDFRAME_CONFIGURE: -#ifdef COMPAT_NETBSD32 +#ifdef RAID_COMPAT32 case RAIDFRAME_CONFIGURE32: #endif @@ -1177,7 +1181,7 @@ raidioctl(dev_t dev, u_long cmd, void *d if (k_cfg == NULL) { return (ENOMEM); } -#ifdef COMPAT_NETBSD32 +#ifdef RAID_COMPAT32 if (cmd == RAIDFRAME_CONFIGURE32 && (l->l_proc->p_flag & PK_32) != 0) MODULE_CALL_HOOK(raidframe_netbsd32_config_hook, @@ -1485,7 +1489,7 @@ raidioctl(dev_t dev, u_long cmd, void *d return(retcode); case RAIDFRAME_GET_INFO: -#ifdef COMPAT_NETBSD32 +#ifdef RAID_COMPAT32 case RAIDFRAME_GET_INFO32: #endif RF_Malloc(d_cfg, sizeof(RF_DeviceConfig_t), @@ -1494,7 +1498,7 @@ raidioctl(dev_t dev, u_long cmd, void *d return (ENOMEM); retcode = rf_get_info(raidPtr, d_cfg); if (retcode == 0) { -#ifdef COMPAT_NETBSD32 +#ifdef RAID_COMPAT32 if (raidframe_netbsd32_config_hook.hooked && cmd == RAIDFRAME_GET_INFO32) ucfgp = NETBSD32PTR64(*(netbsd32_pointer_t *)data);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: martin Date: Sun Feb 3 11:03:53 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: When we force COMPAT_NETBSD32 to be defined, force it to the same value that opt_compate_netbsd32.h would have, otherwise we get a "redefined" error from gcc. XXX this looks fishy, Paul, can you have a look, please? To generate a diff of this commit: cvs rdiff -u -r1.361 -r1.362 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.361 src/sys/dev/raidframe/rf_netbsdkintf.c:1.362 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.361 Sun Feb 3 08:02:24 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Feb 3 11:03:53 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.361 2019/02/03 08:02:24 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.362 2019/02/03 11:03:53 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.361 2019/02/03 08:02:24 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.362 2019/02/03 11:03:53 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -152,7 +152,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkin #ifdef _LP64 #ifndef COMPAT_NETBSD32 -#define COMPAT_NETBSD32 +#define COMPAT_NETBSD32 1 #endif #include "rf_compat32.h" #endif
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: pgoyette Date: Tue Jan 29 23:57:01 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_compat80.c Log Message: KNF - insert tab (thanks to mrg@) NFCI To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/raidframe/rf_compat80.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_compat80.c diff -u src/sys/dev/raidframe/rf_compat80.c:1.5 src/sys/dev/raidframe/rf_compat80.c:1.6 --- src/sys/dev/raidframe/rf_compat80.c:1.5 Tue Jan 29 23:42:06 2019 +++ src/sys/dev/raidframe/rf_compat80.c Tue Jan 29 23:57:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80.c,v 1.5 2019/01/29 23:42:06 oster Exp $ */ +/* $NetBSD: rf_compat80.c,v 1.6 2019/01/29 23:57:01 pgoyette Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -226,7 +226,7 @@ int raidframe_ioctl_80(int cmd, int initted, RF_Raid_t *raidPtr, int unit, void *data, RF_Config_t **k_cfg) { -int error; + int error; switch (cmd) { case RAIDFRAME_CHECK_RECON_STATUS_EXT80:
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Tue Jan 29 23:42:06 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_compat80.c Log Message: Need to return EPASSTHROUGH for ioctls that arn't handled in compat. Thanks to mlelstv for finding this! To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/raidframe/rf_compat80.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_compat80.c diff -u src/sys/dev/raidframe/rf_compat80.c:1.4 src/sys/dev/raidframe/rf_compat80.c:1.5 --- src/sys/dev/raidframe/rf_compat80.c:1.4 Tue Jan 29 09:28:50 2019 +++ src/sys/dev/raidframe/rf_compat80.c Tue Jan 29 23:42:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80.c,v 1.4 2019/01/29 09:28:50 pgoyette Exp $ */ +/* $NetBSD: rf_compat80.c,v 1.5 2019/01/29 23:42:06 oster Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -242,7 +242,7 @@ int error; case RAIDFRAME_FAIL_DISK80: return EPASSTHROUGH; default: - return EINVAL; + return EPASSTHROUGH; } switch (cmd) {
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: bad Date: Mon Jan 28 21:14:08 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: print additional debug information. make rf_containsboot() return 0 if bdv == NULL, to aid in the former. As discussed 1 week ago on tech-kern. To generate a diff of this commit: cvs rdiff -u -r1.358 -r1.359 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.358 src/sys/dev/raidframe/rf_netbsdkintf.c:1.359 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.358 Sun Jan 27 02:08:42 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Jan 28 21:14:08 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.359 2019/01/28 21:14:08 bad Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.359 2019/01/28 21:14:08 bad Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -466,8 +466,15 @@ rf_autoconfig(device_t self) static int rf_containsboot(RF_Raid_t *r, device_t bdv) { - const char *bootname = device_xname(bdv); - size_t len = strlen(bootname); + const char *bootname; + size_t len; + + /* if bdv is NULL, the set can't contain it. exit early. */ + if (bdv == NULL) + return 0; + + bootname = device_xname(bdv); + len = strlen(bootname); for (int col = 0; col < r->numCol; col++) { const char *devname = r->Disks[col].devname; @@ -506,8 +513,8 @@ rf_buildroothack(RF_ConfigSet_t *config_ cset->ac->clabel->autoconfigure == 1) { sc = rf_auto_config_set(cset); if (sc != NULL) { -aprint_debug("raid%d: configured ok\n", -sc->sc_unit); +aprint_debug("raid%d: configured ok, rootable %d\n", +sc->sc_unit, cset->rootable); if (cset->rootable) { rsc = sc; num_root++; @@ -531,8 +538,10 @@ rf_buildroothack(RF_ConfigSet_t *config_ /* if the user has specified what the root device should be then we don't touch booted_device or boothowto... */ - if (rootspec != NULL) + if (rootspec != NULL) { + DPRINTF("%s: rootspec %s\n", __func__, rootspec); return; + } /* we found something bootable... */ @@ -574,9 +583,12 @@ rf_buildroothack(RF_ConfigSet_t *config_ candidate_root = dksc->sc_dev; DPRINTF("%s: candidate root=%p\n", __func__, candidate_root); DPRINTF("%s: booted_device=%p root_partition=%d " - "contains_boot=%d\n", __func__, booted_device, - rsc->sc_r.root_partition, - rf_containsboot(&rsc->sc_r, booted_device)); + "contains_boot=%d", + __func__, booted_device, rsc->sc_r.root_partition, + rf_containsboot(&rsc->sc_r, booted_device)); + /* XXX the check for booted_device == NULL can probably be + * dropped, now that rf_containsboot handles that case. + */ if (booted_device == NULL || rsc->sc_r.root_partition == 1 || rf_containsboot(&rsc->sc_r, booted_device)) {
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Tue Jan 8 07:18:18 UTC 2019 Modified Files: src/sys/dev/raidframe: rf_driver.c rf_netbsdkintf.c rf_raid.h Log Message: remove the final tsleep/wakeup pair in raidframe. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.356 -r1.357 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/raidframe/rf_raid.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_driver.c diff -u src/sys/dev/raidframe/rf_driver.c:1.133 src/sys/dev/raidframe/rf_driver.c:1.134 --- src/sys/dev/raidframe/rf_driver.c:1.133 Sat Dec 10 23:03:27 2016 +++ src/sys/dev/raidframe/rf_driver.c Tue Jan 8 07:18:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.133 2016/12/10 23:03:27 maya Exp $ */ +/* $NetBSD: rf_driver.c,v 1.134 2019/01/08 07:18:18 mrg Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.133 2016/12/10 23:03:27 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.134 2019/01/08 07:18:18 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -227,15 +227,14 @@ rf_Shutdown(RF_Raid_t *raidPtr) while (raidPtr->nAccOutstanding) { rf_wait_cond2(raidPtr->outstandingCond, raidPtr->rad_lock); } - rf_unlock_mutex2(raidPtr->rad_lock); /* Wait for any parity re-writes to stop... */ while (raidPtr->parity_rewrite_in_progress) { printf("raid%d: Waiting for parity re-write to exit...\n", raidPtr->raidid); - tsleep(&raidPtr->parity_rewrite_in_progress, PRIBIO, - "rfprwshutdown", 0); + rf_wait_cond2(raidPtr->parity_rewrite_cv, raidPtr->rad_lock); } + rf_unlock_mutex2(raidPtr->rad_lock); /* Wait for any reconstruction to stop... */ rf_lock_mutex2(raidPtr->mutex); @@ -918,6 +917,7 @@ rf_alloc_mutex_cond(RF_Raid_t *raidPtr) rf_init_mutex2(raidPtr->mutex, IPL_VM); rf_init_cond2(raidPtr->outstandingCond, "rfocond"); + rf_init_cond2(raidPtr->parity_rewrite_cv, "rfprwshutdown"); rf_init_mutex2(raidPtr->rad_lock, IPL_VM); rf_init_mutex2(raidPtr->access_suspend_mutex, IPL_VM); @@ -938,6 +938,7 @@ rf_destroy_mutex_cond(RF_Raid_t *raidPtr rf_destroy_mutex2(raidPtr->access_suspend_mutex); rf_destroy_cond2(raidPtr->access_suspend_cv); + rf_destroy_cond2(raidPtr->parity_rewrite_cv); rf_destroy_cond2(raidPtr->outstandingCond); rf_destroy_mutex2(raidPtr->rad_lock); Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.356 src/sys/dev/raidframe/rf_netbsdkintf.c:1.357 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.356 Tue Jan 23 22:42:29 2018 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Jan 8 07:18:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.356 2018/01/23 22:42:29 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.357 2019/01/08 07:18:18 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356 2018/01/23 22:42:29 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.357 2019/01/08 07:18:18 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -2683,7 +2683,9 @@ rf_RewriteParityThread(RF_Raid_t *raidPt /* Anyone waiting for us to stop? If so, inform them... */ if (raidPtr->waitShutdown) { - wakeup(&raidPtr->parity_rewrite_in_progress); + rf_lock_mutex2(raidPtr->rad_lock); + cv_broadcast(&raidPtr->parity_rewrite_cv); + rf_unlock_mutex2(raidPtr->rad_lock); } /* That's all... */ Index: src/sys/dev/raidframe/rf_raid.h diff -u src/sys/dev/raidframe/rf_raid.h:1.45 src/sys/dev/raidframe/rf_raid.h:1.46 --- src/sys/dev/raidframe/rf_raid.h:1.45 Sat Oct 18 08:33:28 2014 +++ src/sys/dev/raidframe/rf_raid.h Tue Jan 8 07:18:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid.h,v 1.45 2014/10/18 08:33:28 snj Exp $ */ +/* $NetBSD: rf_raid.h,v 1.46 2019/01/08 07:18:18 mrg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -214,6 +214,7 @@ struct RF_Raid_s { int copyback_in_progress; int adding_hot_spare; + rf_declare_cond2(parity_rewrite_cv); rf_declare_cond2(adding_hot_spare_cv); /*
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Sat Jun 9 21:18:41 UTC 2018 Modified Files: src/sys/dev/raidframe: rf_layout.h Log Message: Fix two mis-spellings in comments. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_layout.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_layout.h diff -u src/sys/dev/raidframe/rf_layout.h:1.17 src/sys/dev/raidframe/rf_layout.h:1.18 --- src/sys/dev/raidframe/rf_layout.h:1.17 Sun Mar 4 06:02:38 2007 +++ src/sys/dev/raidframe/rf_layout.h Sat Jun 9 21:18:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_layout.h,v 1.17 2007/03/04 06:02:38 christos Exp $ */ +/* $NetBSD: rf_layout.h,v 1.18 2018/06/09 21:18:41 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -88,7 +88,7 @@ struct RF_RaidLayout_s { * The mapping code returns a pointer to a list of AccessStripeMap structures, which * describes all the mapping information about an access. The list contains one * AccessStripeMap structure per stripe touched by the access. Each element in the list - * contains a stripe identifier and a pointer to a list of PhysDiskAddr structuress. Each + * contains a stripe identifier and a pointer to a list of PhysDiskAddr structures. Each * element in this latter list describes the physical location of a stripe unit accessed * within the corresponding stripe. * @@ -192,7 +192,7 @@ typedef struct RF_FailedStripe_s RF_Fail struct RF_FailedStripe_s { RF_VoidFunctionPointerListElem_t *vfple; /* linked list of pointers to DAG creation functions for stripes */ - RF_VoidFunctionPointerListElem_t *bvfple; /* linked list of poitners to DAG creation + RF_VoidFunctionPointerListElem_t *bvfple; /* linked list of pointers to DAG creation functions for blocks */ RF_ASMHeaderListElem_t *asmh_u;/* Access Stripe Map Headers for regular stripes */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Sat Jan 20 01:32:45 UTC 2018 Modified Files: src/sys/dev/raidframe: raidframeio.h rf_compat32.h rf_compat80.c rf_compat80.h rf_netbsdkintf.c Log Message: fixes for the previous, noted by nakayama@. - RAIDFRAME_CONFIGURE needs to be versioned as the rows was removed, adding RAIDFRAME_CONFIGURE80, rf_config80() etc. - RAIDFRAME_CONFIGURE32 changes to match - rf_get_info80() passed the wrong source to copyout() some fixes to my original change were independantly made by nakayama@ who confirmed the changes work properly now. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/raidframe/raidframeio.h cvs rdiff -u -r1.1 -r1.2 src/sys/dev/raidframe/rf_compat32.h \ src/sys/dev/raidframe/rf_compat80.c src/sys/dev/raidframe/rf_compat80.h cvs rdiff -u -r1.354 -r1.355 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/raidframeio.h diff -u src/sys/dev/raidframe/raidframeio.h:1.8 src/sys/dev/raidframe/raidframeio.h:1.9 --- src/sys/dev/raidframe/raidframeio.h:1.8 Thu Jan 18 00:32:49 2018 +++ src/sys/dev/raidframe/raidframeio.h Sat Jan 20 01:32:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: raidframeio.h,v 1.8 2018/01/18 00:32:49 mrg Exp $ */ +/* $NetBSD: raidframeio.h,v 1.9 2018/01/20 01:32:45 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -123,7 +123,7 @@ #define RAIDFRAME_CHECK_RECON_STATUS_EXT _IOWR('r', 32, RF_ProgressInfo_t) #define RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT _IOWR ('r', 33, RF_ProgressInfo_t) #define RAIDFRAME_CHECK_COPYBACK_STATUS_EXT _IOWR ('r', 34, RF_ProgressInfo_t) -#define RAIDFRAME_CONFIGURE _IOW ('r', 35, void *) /* configure the driver */ +/* 35 was RAIDFRAME_CONFIGURE */ /* 36 was RAIDFRAME_GET_INFO */ #define RAIDFRAME_PARITYMAP_STATUS _IOR('r', 37, struct rf_pmstat) @@ -132,5 +132,6 @@ #define RAIDFRAME_PARITYMAP_SET_PARAMS _IOW('r', 40, struct rf_pmparams) #define RAIDFRAME_SET_LAST_UNIT _IOW('r', 41, int) #define RAIDFRAME_GET_INFO _IOWR('r', 42, RF_DeviceConfig_t *) /* get configuration */ +#define RAIDFRAME_CONFIGURE _IOW ('r', 43, void *) /* configure the driver */ #endif/* !_RF_RAIDFRAMEIO_H_ */ Index: src/sys/dev/raidframe/rf_compat32.h diff -u src/sys/dev/raidframe/rf_compat32.h:1.1 src/sys/dev/raidframe/rf_compat32.h:1.2 --- src/sys/dev/raidframe/rf_compat32.h:1.1 Thu Jan 18 00:32:49 2018 +++ src/sys/dev/raidframe/rf_compat32.h Sat Jan 20 01:32:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat32.h,v 1.1 2018/01/18 00:32:49 mrg Exp $ */ +/* $NetBSD: rf_compat32.h,v 1.2 2018/01/20 01:32:45 mrg Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -33,7 +33,7 @@ #include -#define RAIDFRAME_CONFIGURE32 _IOW ('r', 35, netbsd32_pointer_t) /* configure the driver */ +#define RAIDFRAME_CONFIGURE32 _IOW ('r', 43, netbsd32_pointer_t) /* configure the driver */ #define RAIDFRAME_GET_INFO32 _IOWR('r', 42, netbsd32_pointer_t) /* get configuration */ int rf_config_netbsd32(void *data, RF_Config_t *k_cfg); Index: src/sys/dev/raidframe/rf_compat80.c diff -u src/sys/dev/raidframe/rf_compat80.c:1.1 src/sys/dev/raidframe/rf_compat80.c:1.2 --- src/sys/dev/raidframe/rf_compat80.c:1.1 Thu Jan 18 00:32:49 2018 +++ src/sys/dev/raidframe/rf_compat80.c Sat Jan 20 01:32:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80.c,v 1.1 2018/01/18 00:32:49 mrg Exp $ */ +/* $NetBSD: rf_compat80.c,v 1.2 2018/01/20 01:32:45 mrg Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -112,7 +112,7 @@ rf_get_info80(RF_Raid_t *raidPtr, void * rf_copy_raiddisk80(&config->spares[i], &config80->spares[i]); } - rv = copyout(&config, *configPtr80, sizeof *config80); + rv = copyout(config80, *configPtr80, sizeof *config80); } RF_Free(config, sizeof(RF_DeviceConfig_t)); RF_Free(config80, sizeof(RF_DeviceConfig_t80)); @@ -146,3 +146,74 @@ rf_get_component_label80(RF_Raid_t *raid return retcode; } + +int +rf_config80(RF_Raid_t *raidPtr, int unit, void *data, RF_Config_t **k_cfgp) +{ + RF_Config_t80 *u80_cfg, *k80_cfg; + RF_Config_t *k_cfg; + size_t i, j; + int error; + + if (raidPtr->valid) { + /* There is a valid RAID set running on this unit! */ + printf("raid%d: Device already configured!\n", unit); + return EINVAL; + } + + /* copy-in the configuration information */ + /* data points to a pointer to the configuration structure */ + + u80_cfg = *((RF_Config_t80 **) data); + RF_Malloc(k80_cfg, sizeof(RF_Config_t80), (RF_Config_t80 *)); + if (k80_cfg == NULL) + return ENOMEM; + + error = copyin(u80_cfg, k80_cfg, sizeof(RF_Config_t80)); + if (error) { + RF_Free(k80_cfg, sizeof(RF_Config_t80)); + return error; + } + RF_Malloc(k_cfg, sizeof(RF_Config_t), (RF_Config_t *)); + if (k_cfg == NULL) { + RF_Free(k80_cfg,
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: skrll Date: Fri Jan 19 09:04:24 UTC 2018 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Fix some ARM kernel builds. ARM abuses compat32 for ABI compatibility and this means some ioctls overlap. To generate a diff of this commit: cvs rdiff -u -r1.353 -r1.354 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.353 src/sys/dev/raidframe/rf_netbsdkintf.c:1.354 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.353 Thu Jan 18 00:32:49 2018 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Jan 19 09:04:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.353 2018/01/18 00:32:49 mrg Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.354 2018/01/19 09:04:23 skrll Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.353 2018/01/18 00:32:49 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.354 2018/01/19 09:04:23 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1115,8 +1115,10 @@ raidioctl(dev_t dev, u_long cmd, void *d case RAIDFRAME_GET_COMPONENT_LABEL80: #endif #ifdef COMPAT_NETBSD32 +#ifdef _LP64 case RAIDFRAME_GET_INFO32: #endif +#endif if ((rs->sc_flags & RAIDF_INITED) == 0) return (ENXIO); } @@ -1152,8 +1154,10 @@ raidioctl(dev_t dev, u_long cmd, void *d /* configure the system */ case RAIDFRAME_CONFIGURE: #ifdef COMPAT_NETBSD32 +#ifdef _LP64 case RAIDFRAME_CONFIGURE32: #endif +#endif if (raidPtr->valid) { /* There is a valid RAID set running on this unit! */ @@ -1169,11 +1173,13 @@ raidioctl(dev_t dev, u_long cmd, void *d return (ENOMEM); } #ifdef COMPAT_NETBSD32 +#ifdef _LP64 if (cmd == RAIDFRAME_CONFIGURE32 && (l->l_proc->p_flag & PK_32) != 0) retcode = rf_config_netbsd32(data, k_cfg); else #endif +#endif { u_cfg = *((RF_Config_t **) data); retcode = copyin(u_cfg, k_cfg, sizeof(RF_Config_t)); @@ -1476,8 +1482,10 @@ raidioctl(dev_t dev, u_long cmd, void *d case RAIDFRAME_GET_INFO: #ifdef COMPAT_NETBSD32 +#ifdef _LP64 case RAIDFRAME_GET_INFO32: #endif +#endif RF_Malloc(d_cfg, sizeof(RF_DeviceConfig_t), (RF_DeviceConfig_t *)); if (d_cfg == NULL) @@ -1485,10 +1493,12 @@ raidioctl(dev_t dev, u_long cmd, void *d retcode = rf_get_info(raidPtr, d_cfg); if (retcode == 0) { #ifdef COMPAT_NETBSD32 +#ifdef _LP64 if (cmd == RAIDFRAME_GET_INFO32) ucfgp = NETBSD32PTR64(*(netbsd32_pointer_t *)data); else #endif +#endif ucfgp = *(RF_DeviceConfig_t **)data; retcode = copyout(d_cfg, ucfgp, sizeof(RF_DeviceConfig_t)); }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Tue Nov 14 14:27:54 UTC 2017 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c rf_reconmap.c Log Message: check the result of pool_prime. To generate a diff of this commit: cvs rdiff -u -r1.351 -r1.352 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_reconmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.351 src/sys/dev/raidframe/rf_netbsdkintf.c:1.352 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.351 Wed Nov 8 20:02:56 2017 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Nov 14 09:27:54 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.352 2017/11/14 14:27:54 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.351 2017/11/09 01:02:56 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.352 2017/11/14 14:27:54 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -3575,9 +3575,12 @@ void rf_pool_init(struct pool *p, size_t size, const char *w_chan, size_t xmin, size_t xmax) { + int error; + pool_init(p, size, 0, 0, 0, w_chan, NULL, IPL_BIO); pool_sethiwat(p, xmax); - pool_prime(p, xmin); + if ((error = pool_prime(p, xmin)) != 0) + panic("%s: failed to prime pool: %d", __func__, error); pool_setlowat(p, xmin); } Index: src/sys/dev/raidframe/rf_reconmap.c diff -u src/sys/dev/raidframe/rf_reconmap.c:1.35 src/sys/dev/raidframe/rf_reconmap.c:1.36 --- src/sys/dev/raidframe/rf_reconmap.c:1.35 Wed Jan 4 10:51:41 2017 +++ src/sys/dev/raidframe/rf_reconmap.c Tue Nov 14 09:27:54 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconmap.c,v 1.35 2017/01/04 15:51:41 christos Exp $ */ +/* $NetBSD: rf_reconmap.c,v 1.36 2017/11/14 14:27:54 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.35 2017/01/04 15:51:41 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.36 2017/11/14 14:27:54 christos Exp $"); #include "rf_raid.h" #include @@ -86,6 +86,7 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_S RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; RF_ReconUnitCount_t num_rus = layoutPtr->stripeUnitsPerDisk / layoutPtr->SUsPerRU; RF_ReconMap_t *p; + int error; RF_Malloc(p, sizeof(RF_ReconMap_t), (RF_ReconMap_t *)); p->sectorsPerReconUnit = ru_sectors; @@ -107,7 +108,8 @@ rf_MakeReconMap(RF_Raid_t *raidPtr, RF_S pool_init(&p->elem_pool, sizeof(RF_ReconMapListElem_t), 0, 0, 0, "raidreconpl", NULL, IPL_BIO); - pool_prime(&p->elem_pool, RF_NUM_RECON_POOL_ELEM); + if ((error = pool_prime(&p->elem_pool, RF_NUM_RECON_POOL_ELEM)) != 0) + panic("%s: failed to prime pool: %d", __func__, error); rf_init_mutex2(p->mutex, IPL_VM); rf_init_cond2(p->cv, "reconupdate");
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: jdolecek Date: Wed Apr 5 20:30:55 UTC 2017 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: rf_get_component_caches(): remove useless condition To generate a diff of this commit: cvs rdiff -u -r1.348 -r1.349 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.348 src/sys/dev/raidframe/rf_netbsdkintf.c:1.349 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.348 Wed Apr 5 19:40:26 2017 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Apr 5 20:30:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.348 2017/04/05 19:40:26 jdolecek Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.349 2017/04/05 20:30:55 jdolecek Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.348 2017/04/05 19:40:26 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.349 2017/04/05 20:30:55 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -3723,7 +3723,7 @@ rf_get_component_caches(RF_Raid_t *raidP } } - *data = (dkwhole >= 0) ? dkwhole : 0; + *data = dkwhole; return 0; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: jdolecek Date: Wed Apr 5 19:40:26 UTC 2017 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: add support for DIOCGCACHE; contrary to DIOCCACHESYNC, query any non-dead disk in the set, even currently reconstring one To generate a diff of this commit: cvs rdiff -u -r1.347 -r1.348 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.347 src/sys/dev/raidframe/rf_netbsdkintf.c:1.348 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.347 Mon Sep 19 23:37:10 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Apr 5 19:40:26 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.347 2016/09/19 23:37:10 jdolecek Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.348 2017/04/05 19:40:26 jdolecek Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.347 2016/09/19 23:37:10 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.348 2017/04/05 19:40:26 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -188,6 +188,7 @@ static void InitBP(struct buf *, struct struct raid_softc; static void raidinit(struct raid_softc *); static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp); +static int rf_get_component_caches(RF_Raid_t *raidPtr, int *); static int raid_match(device_t, cfdata_t, void *); static void raid_attach(device_t, device_t, void *); @@ -1787,6 +1788,10 @@ raidioctl(dev_t dev, u_long cmd, void *d */ switch (cmd) { + case DIOCGCACHE: + retcode = rf_get_component_caches(raidPtr, (int *)data); + break; + case DIOCCACHESYNC: retcode = rf_sync_component_caches(raidPtr); break; @@ -3679,6 +3684,50 @@ rf_set_geometry(struct raid_softc *rs, R disk_set_info(dksc->sc_dev, &dksc->sc_dkdev, NULL); } +/* + * Get cache info for all the components (including spares). + * Returns intersection of all the cache flags of all disks, or first + * error if any encountered. + * XXXfua feature flags can change as spares are added - lock down somehow + */ +static int +rf_get_component_caches(RF_Raid_t *raidPtr, int *data) +{ + int c; + int error; + int dkwhole = 0, dkpart; + + for (c = 0; c < raidPtr->numCol + raidPtr->numSpare; c++) { + /* + * Check any non-dead disk, even when currently being + * reconstructed. + */ + if (!RF_DEAD_DISK(raidPtr->Disks[c].status) + || raidPtr->Disks[c].status == rf_ds_reconstructing) { + error = VOP_IOCTL(raidPtr->raid_cinfo[c].ci_vp, + DIOCGCACHE, &dkpart, FREAD, NOCRED); + if (error) { +if (error != ENODEV) { + printf("raid%d: get cache for component %s failed\n", + raidPtr->raidid, + raidPtr->Disks[c].devname); +} + +return error; + } + + if (c == 0) +dkwhole = dkpart; + else +dkwhole = DKCACHE_COMBINE(dkwhole, dkpart); + } + } + + *data = (dkwhole >= 0) ? dkwhole : 0; + + return 0; +} + /* * Implement forwarding of the DIOCCACHESYNC ioctl to each of the components. * We end up returning whatever error was returned by the first cache flush
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Fri Jan 13 13:01:13 UTC 2017 Modified Files: src/sys/dev/raidframe: rf_disks.c Log Message: more faithful to the original (from coypu) To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/dev/raidframe/rf_disks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_disks.c diff -u src/sys/dev/raidframe/rf_disks.c:1.88 src/sys/dev/raidframe/rf_disks.c:1.89 --- src/sys/dev/raidframe/rf_disks.c:1.88 Thu Jan 12 23:22:16 2017 +++ src/sys/dev/raidframe/rf_disks.c Fri Jan 13 08:01:13 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.88 2017/01/13 04:22:16 christos Exp $ */ +/* $NetBSD: rf_disks.c,v 1.89 2017/01/13 13:01:13 christos Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -60,7 +60,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.88 2017/01/13 04:22:16 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.89 2017/01/13 13:01:13 christos Exp $"); #include @@ -701,16 +701,17 @@ static int rf_check_label_vitals(RF_Raid static void -rf_handle_hosed(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, int hosed_column) +rf_handle_hosed(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, int hosed_column, +int again) { printf("Hosed component: %s\n", &cfgPtr->devnames[0][hosed_column][0]); if (!cfgPtr->force) return; /* we'll fail this component, as if there are - other major errors, we arn't forcing things + other major errors, we aren't forcing things and we'll abort the config anyways */ - if (raidPtr->Disks[hosed_column].status == rf_ds_failed) + if (again && raidPtr->Disks[hosed_column].status == rf_ds_failed) return; raidPtr->Disks[hosed_column].status = rf_ds_failed; @@ -840,7 +841,8 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Co } } if (hosed_column != -1) -rf_handle_hosed(raidPtr, cfgPtr, hosed_column); +rf_handle_hosed(raidPtr, cfgPtr, hosed_column, +0); } else { too_fatal = 1; } @@ -897,7 +899,8 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Co } } if (hosed_column != -1) -rf_handle_hosed(raidPtr, cfgPtr, hosed_column); +rf_handle_hosed(raidPtr, cfgPtr, hosed_column, +1); } else { too_fatal = 1; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Fri Jan 13 04:22:16 UTC 2017 Modified Files: src/sys/dev/raidframe: rf_disks.c Log Message: Don't consider a disk hosed if we did not find a column for it; dedup code. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/dev/raidframe/rf_disks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_disks.c diff -u src/sys/dev/raidframe/rf_disks.c:1.87 src/sys/dev/raidframe/rf_disks.c:1.88 --- src/sys/dev/raidframe/rf_disks.c:1.87 Sat Oct 18 04:33:28 2014 +++ src/sys/dev/raidframe/rf_disks.c Thu Jan 12 23:22:16 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.87 2014/10/18 08:33:28 snj Exp $ */ +/* $NetBSD: rf_disks.c,v 1.88 2017/01/13 04:22:16 christos Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -60,7 +60,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.87 2014/10/18 08:33:28 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.88 2017/01/13 04:22:16 christos Exp $"); #include @@ -700,6 +700,24 @@ static int rf_check_label_vitals(RF_Raid } +static void +rf_handle_hosed(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, int hosed_column) +{ + printf("Hosed component: %s\n", &cfgPtr->devnames[0][hosed_column][0]); + if (!cfgPtr->force) + return; + + /* we'll fail this component, as if there are + other major errors, we arn't forcing things + and we'll abort the config anyways */ + if (raidPtr->Disks[hosed_column].status == rf_ds_failed) + return; + + raidPtr->Disks[hosed_column].status = rf_ds_failed; + raidPtr->numFailures++; + raidPtr->status = rf_rs_degraded; +} + /* rf_CheckLabels() - check all the component labels for consistency. @@ -727,11 +745,9 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Co int hosed_column; int too_fatal; int parity_good; - int force; hosed_column = -1; too_fatal = 0; - force = cfgPtr->force; /* We're going to try to be a little intelligent here. If one @@ -823,17 +839,8 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Co break; } } - printf("Hosed component: %s\n", - &cfgPtr->devnames[0][hosed_column][0]); - if (!force) { -/* we'll fail this component, as if there are - other major errors, we arn't forcing things - and we'll abort the config anyways */ -raidPtr->Disks[hosed_column].status - = rf_ds_failed; -raidPtr->numFailures++; -raidPtr->status = rf_rs_degraded; - } + if (hosed_column != -1) +rf_handle_hosed(raidPtr, cfgPtr, hosed_column); } else { too_fatal = 1; } @@ -889,19 +896,8 @@ rf_CheckLabels(RF_Raid_t *raidPtr, RF_Co } } } - printf("Hosed component: %s\n", - &cfgPtr->devnames[0][hosed_column][0]); - if (!force) { -/* we'll fail this component, as if there are - other major errors, we arn't forcing things - and we'll abort the config anyways */ -if (raidPtr->Disks[hosed_column].status != rf_ds_failed) { - raidPtr->Disks[hosed_column].status - = rf_ds_failed; - raidPtr->numFailures++; - raidPtr->status = rf_rs_degraded; -} - } + if (hosed_column != -1) +rf_handle_hosed(raidPtr, cfgPtr, hosed_column); } else { too_fatal = 1; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Jan 4 15:51:41 UTC 2017 Modified Files: src/sys/dev/raidframe: rf_reconmap.c Log Message: PR/51776: David Binderman: Remove unused variable. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_reconmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_reconmap.c diff -u src/sys/dev/raidframe/rf_reconmap.c:1.34 src/sys/dev/raidframe/rf_reconmap.c:1.35 --- src/sys/dev/raidframe/rf_reconmap.c:1.34 Mon Feb 20 17:42:05 2012 +++ src/sys/dev/raidframe/rf_reconmap.c Wed Jan 4 10:51:41 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconmap.c,v 1.34 2012/02/20 22:42:05 oster Exp $ */ +/* $NetBSD: rf_reconmap.c,v 1.35 2017/01/04 15:51:41 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.34 2012/02/20 22:42:05 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.35 2017/01/04 15:51:41 christos Exp $"); #include "rf_raid.h" #include @@ -324,13 +324,8 @@ void rf_FreeReconMap(RF_ReconMap_t *mapPtr) { RF_ReconMapListElem_t *p, *q; - RF_ReconUnitCount_t numRUs; RF_ReconUnitNum_t i; - numRUs = mapPtr->sectorsInDisk / mapPtr->sectorsPerReconUnit; - if (mapPtr->sectorsInDisk % mapPtr->sectorsPerReconUnit) - numRUs++; - for (i = 0; i < mapPtr->status_size; i++) { p = mapPtr->status[i]; while (p != RU_NOTHING && p != RU_ALL) {
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Jan 4 15:50:34 UTC 2017 Modified Files: src/sys/dev/raidframe: rf_aselect.c Log Message: PR/51775: David Binderman: Remove unused variable. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_aselect.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_aselect.c diff -u src/sys/dev/raidframe/rf_aselect.c:1.28 src/sys/dev/raidframe/rf_aselect.c:1.29 --- src/sys/dev/raidframe/rf_aselect.c:1.28 Sun Sep 15 08:11:16 2013 +++ src/sys/dev/raidframe/rf_aselect.c Wed Jan 4 10:50:34 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_aselect.c,v 1.28 2013/09/15 12:11:16 martin Exp $ */ +/* $NetBSD: rf_aselect.c,v 1.29 2017/01/04 15:50:34 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.28 2013/09/15 12:11:16 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.29 2017/01/04 15:50:34 christos Exp $"); #include @@ -128,7 +128,7 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t * RF_VoidFuncPtr bFunc; int numStripesBailed = 0, cantCreateDAGs = RF_FALSE; int numStripeUnitsBailed = 0; - int stripeNum, numUnitDags = 0, stripeUnitNum, numBlockDags = 0; + int stripeNum, stripeUnitNum, numBlockDags = 0; RF_StripeNum_t numStripeUnits; RF_SectorNum_t numBlocks; RF_RaidAddr_t address; @@ -266,8 +266,6 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t * cantCreateDAGs = RF_TRUE; } numStripeUnitsBailed++; -} else { - numUnitDags++; } } RF_ASSERT(j == numStripeUnits);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: nat Date: Sun Dec 11 05:27:00 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_dagffrd.c rf_engine.c Log Message: Ensure variables are initialized. Fixes error due to -Wmaybe-unitialized. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/rf_dagffrd.c cvs rdiff -u -r1.51 -r1.52 src/sys/dev/raidframe/rf_engine.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_dagffrd.c diff -u src/sys/dev/raidframe/rf_dagffrd.c:1.19 src/sys/dev/raidframe/rf_dagffrd.c:1.20 --- src/sys/dev/raidframe/rf_dagffrd.c:1.19 Sun Sep 15 12:23:06 2013 +++ src/sys/dev/raidframe/rf_dagffrd.c Sun Dec 11 05:27:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagffrd.c,v 1.19 2013/09/15 12:23:06 martin Exp $ */ +/* $NetBSD: rf_dagffrd.c,v 1.20 2016/12/11 05:27:00 nat Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.19 2013/09/15 12:23:06 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.20 2016/12/11 05:27:00 nat Exp $"); #include @@ -139,6 +139,10 @@ rf_CreateNonredundantDAG(RF_Raid_t *raid n = asmap->numStripeUnitsAccessed; dag_h->creator = "NonredundantDAG"; + doFunc = rf_NullNodeFunc; + undoFunc = rf_NullNodeUndoFunc; + name = NULL; + RF_ASSERT(RF_IO_IS_R_OR_W(type)); switch (type) { case RF_IO_TYPE_READ: Index: src/sys/dev/raidframe/rf_engine.c diff -u src/sys/dev/raidframe/rf_engine.c:1.51 src/sys/dev/raidframe/rf_engine.c:1.52 --- src/sys/dev/raidframe/rf_engine.c:1.51 Sun Jan 3 08:17:24 2016 +++ src/sys/dev/raidframe/rf_engine.c Sun Dec 11 05:27:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_engine.c,v 1.51 2016/01/03 08:17:24 mlelstv Exp $ */ +/* $NetBSD: rf_engine.c,v 1.52 2016/12/11 05:27:00 nat Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -55,7 +55,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.51 2016/01/03 08:17:24 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.52 2016/12/11 05:27:00 nat Exp $"); #include @@ -229,14 +229,14 @@ NodeReady(RF_DagNode_t *node) { int ready; + ready = RF_FALSE; + switch (node->dagHdr->status) { case rf_enable: case rf_rollForward: if ((node->status == rf_wait) && (node->numAntecedents == node->numAntDone)) ready = RF_TRUE; - else - ready = RF_FALSE; break; case rf_rollBackward: RF_ASSERT(node->numSuccDone <= node->numSuccedents); @@ -245,8 +245,6 @@ NodeReady(RF_DagNode_t *node) if ((node->status == rf_good) && (node->numSuccDone == node->numSuccedents)) ready = RF_TRUE; - else - ready = RF_FALSE; break; default: printf("Execution engine found illegal DAG status in NodeReady\n");
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: maya Date: Sat Dec 10 23:03:27 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_driver.c rf_general.h Log Message: raidframe: use existing routines to print an error and panic. fixes the i386 ALL build with clang which complained about the format string not being a string literal, and lets us get rid of rf_panicbuf. note: kern_assert is not KASSERT. it should panic as long as the string is not NULL. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.133 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_general.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_driver.c diff -u src/sys/dev/raidframe/rf_driver.c:1.132 src/sys/dev/raidframe/rf_driver.c:1.133 --- src/sys/dev/raidframe/rf_driver.c:1.132 Sat Dec 26 00:58:45 2015 +++ src/sys/dev/raidframe/rf_driver.c Sat Dec 10 23:03:27 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $ */ +/* $NetBSD: rf_driver.c,v 1.133 2016/12/10 23:03:27 maya Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.133 2016/12/10 23:03:27 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -121,9 +121,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_driver.c, #define RF_MAX_FREE_RAD 128 #define RF_MIN_FREE_RAD 32 -/* debug variables */ -charrf_panicbuf[2048]; /* a buffer to hold an error msg when we panic */ - /* main configuration routines */ static int raidframe_booted = 0; @@ -888,17 +885,15 @@ rf_ConfigureDebug(RF_Config_t *cfgPtr) void rf_print_panic_message(int line, const char *file) { - snprintf(rf_panicbuf, sizeof(rf_panicbuf), - "raidframe error at line %d file %s", line, file); + kern_assert("raidframe error at line %d file %s", line, file); } #ifdef RAID_DIAGNOSTIC void rf_print_assert_panic_message(int line, const char *file, const char *condition) { - snprintf(rf_panicbuf, sizeof(rf_panicbuf), - "raidframe error at line %d file %s (failed asserting %s)\n", - line, file, condition); + kern_assert("raidframe error at line %d file %s (failed asserting %s)\n", + line, file, condition); } #endif Index: src/sys/dev/raidframe/rf_general.h diff -u src/sys/dev/raidframe/rf_general.h:1.21 src/sys/dev/raidframe/rf_general.h:1.22 --- src/sys/dev/raidframe/rf_general.h:1.21 Tue Mar 25 16:19:14 2014 +++ src/sys/dev/raidframe/rf_general.h Sat Dec 10 23:03:27 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_general.h,v 1.21 2014/03/25 16:19:14 christos Exp $ */ +/* $NetBSD: rf_general.h,v 1.22 2016/12/10 23:03:27 maya Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -54,14 +54,12 @@ void rf_print_unable_to_init_mutex(const void rf_print_unable_to_add_shutdown(const char *, int, int); -extern char rf_panicbuf[]; -#define RF_PANIC() {rf_print_panic_message(__LINE__,__FILE__); panic("%s", rf_panicbuf);} +#define RF_PANIC() {rf_print_panic_message(__LINE__,__FILE__);} #if defined(RAID_DIAGNOSTIC) || defined(__COVERITY__) #define RF_ASSERT(_x_) { \ if (!(_x_)) { \ rf_print_assert_panic_message(__LINE__, __FILE__, #_x_); \ -panic(rf_panicbuf); \ } \ } #else /* RAID_DIAGNOSTIC */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Sat Oct 15 20:31:15 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_map.c Log Message: Cleanup/remove unused asm_count. Reported by David Binderman in PR#51552. Thanks! To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/raidframe/rf_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_map.c diff -u src/sys/dev/raidframe/rf_map.c:1.46 src/sys/dev/raidframe/rf_map.c:1.47 --- src/sys/dev/raidframe/rf_map.c:1.46 Fri Nov 14 14:45:34 2014 +++ src/sys/dev/raidframe/rf_map.c Sat Oct 15 20:31:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_map.c,v 1.46 2014/11/14 14:45:34 oster Exp $ */ +/* $NetBSD: rf_map.c,v 1.47 2016/10/15 20:31:15 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ **/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.46 2014/11/14 14:45:34 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.47 2016/10/15 20:31:15 oster Exp $"); #include @@ -557,7 +557,7 @@ rf_FreeAccessStripeMap(RF_AccessStripeMa { RF_AccessStripeMap_t *p; RF_PhysDiskAddr_t *pdp, *trailer, *pdaList = NULL, *pdaEnd = NULL; - int count = 0, t, asm_count = 0; + int count = 0, t; for (p = hdr->stripeMap; p; p = p->next) { @@ -598,8 +598,6 @@ rf_FreeAccessStripeMap(RF_AccessStripeMa } if (trailer) pdaEnd = trailer; - - asm_count++; } /* debug only */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: jdolecek Date: Mon Sep 19 23:37:10 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: fix mistake fallthrough in the ioctl switch introduced in previous commit To generate a diff of this commit: cvs rdiff -u -r1.346 -r1.347 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.346 src/sys/dev/raidframe/rf_netbsdkintf.c:1.347 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.346 Mon Sep 19 23:32:30 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Sep 19 23:37:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.346 2016/09/19 23:32:30 jdolecek Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.347 2016/09/19 23:37:10 jdolecek Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.346 2016/09/19 23:32:30 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.347 2016/09/19 23:37:10 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1789,9 +1789,11 @@ raidioctl(dev_t dev, u_long cmd, void *d switch (cmd) { case DIOCCACHESYNC: retcode = rf_sync_component_caches(raidPtr); + break; default: retcode = dk_ioctl(dksc, dev, cmd, data, flag, l); + break; } return (retcode);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Apr 27 02:47:39 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: provide an empty DPRINTF To generate a diff of this commit: cvs rdiff -u -r1.344 -r1.345 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.344 src/sys/dev/raidframe/rf_netbsdkintf.c:1.345 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.344 Tue Apr 26 22:24:06 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Apr 26 22:47:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.344 2016/04/27 02:24:06 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.345 2016/04/27 02:47:39 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.344 2016/04/27 02:24:06 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.345 2016/04/27 02:47:39 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -163,6 +163,8 @@ int rf_kdebug_level = 0; #ifdef DEBUG_ROOT #define DPRINTF(a, ...) printf(a, __VA_ARGS__) +#else +#define DPRINTF(a, ...) #endif #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0)
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Apr 27 02:24:06 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Extend the "a" partition hack to also mean the first partition on the raid, for non-disklabel based raidframe disks that need root. To generate a diff of this commit: cvs rdiff -u -r1.343 -r1.344 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.343 src/sys/dev/raidframe/rf_netbsdkintf.c:1.344 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.343 Thu Jan 7 09:15:26 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Apr 26 22:24:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.343 2016/01/07 14:15:26 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.344 2016/04/27 02:24:06 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.343 2016/01/07 14:15:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.344 2016/04/27 02:24:06 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -161,6 +161,10 @@ int rf_kdebug_level = 0; #define db1_printf(a) { } #endif/* DEBUG */ +#ifdef DEBUG_ROOT +#define DPRINTF(a, ...) printf(a, __VA_ARGS__) +#endif + #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0) static rf_declare_mutex2(rf_sparet_wait_mutex); static rf_declare_cond2(rf_sparet_wait_cv); @@ -537,12 +541,32 @@ rf_buildroothack(RF_ConfigSet_t *config_ device_t candidate_root; if (dksc->sc_dkdev.dk_nwedges != 0) { char cname[sizeof(cset->ac->devname)]; - /* XXX: assume 'a' */ + /* XXX: assume partition 'a' first */ snprintf(cname, sizeof(cname), "%s%c", device_xname(dksc->sc_dev), 'a'); candidate_root = dkwedge_find_by_wname(cname); + DPRINTF("%s: candidate wedge root=%s\n", __func__, + cname); + if (candidate_root == NULL) { +/* + * If that is not found, because we don't use + * disklabel, return the first dk child + * XXX: we can skip the 'a' check above + * and always do this... + */ +size_t i = 0; +candidate_root = dkwedge_find_by_parent( +device_xname(dksc->sc_dev), &i); + } + DPRINTF("%s: candidate wedge root=%p\n", __func__, + candidate_root); } else candidate_root = dksc->sc_dev; + DPRINTF("%s: candidate root=%p\n", __func__, candidate_root); + DPRINTF("%s: booted_device=%p root_partition=%d " + "contains_boot=%d\n", __func__, booted_device, + rsc->sc_r.root_partition, + rf_containsboot(&rsc->sc_r, booted_device)); if (booted_device == NULL || rsc->sc_r.root_partition == 1 || rf_containsboot(&rsc->sc_r, booted_device)) { @@ -550,6 +574,8 @@ rf_buildroothack(RF_ConfigSet_t *config_ booted_partition = 0; /* XXX assume 'a' */ } } else if (num_root > 1) { + DPRINTF("%s: many roots=%d, %p\n", __func__, num_root, + booted_device); /* * Maybe the MD code can help. If it cannot, then
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: joerg Date: Thu Jan 7 21:57:00 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_dagutils.c Log Message: Don't use for (...); by using an explicit continue as body. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/raidframe/rf_dagutils.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_dagutils.c diff -u src/sys/dev/raidframe/rf_dagutils.c:1.53 src/sys/dev/raidframe/rf_dagutils.c:1.54 --- src/sys/dev/raidframe/rf_dagutils.c:1.53 Wed May 11 18:13:12 2011 +++ src/sys/dev/raidframe/rf_dagutils.c Thu Jan 7 21:57:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagutils.c,v 1.53 2011/05/11 18:13:12 mrg Exp $ */ +/* $NetBSD: rf_dagutils.c,v 1.54 2016/01/07 21:57:00 joerg Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.53 2011/05/11 18:13:12 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagutils.c,v 1.54 2016/01/07 21:57:00 joerg Exp $"); #include @@ -1258,7 +1258,8 @@ rf_compute_workload_shift(RF_Raid_t *rai d = pda->col; /* assign column of dead disk to f */ - for (f = 0; ((!RF_DEAD_DISK(raidPtr->Disks[f].status)) && (f < n)); f++); + for (f = 0; ((!RF_DEAD_DISK(raidPtr->Disks[f].status)) && (f < n)); f++) + continue; RF_ASSERT(f < n); RF_ASSERT(f != d);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Thu Jan 7 08:58:01 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: CID 1347189: Null pointer dereferences To generate a diff of this commit: cvs rdiff -u -r1.341 -r1.342 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.341 src/sys/dev/raidframe/rf_netbsdkintf.c:1.342 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.341 Wed Jan 6 17:40:50 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Thu Jan 7 08:58:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.341 2016/01/06 17:40:50 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.342 2016/01/07 08:58:01 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.341 2016/01/06 17:40:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.342 2016/01/07 08:58:01 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -725,6 +725,10 @@ raid_dumpblocks(device_t dev, void *va, } bdev = bdevsw_lookup(raidPtr->Disks[dumpto].dev); + if (bdev == NULL) { + error = ENXIO; + goto out; + } error = (*bdev->d_dump)(raidPtr->Disks[dumpto].dev, blkno, va, nblk * raidPtr->bytesPerSector);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Jan 6 17:40:50 UTC 2016 Modified Files: src/sys/dev/raidframe: raidframeio.h rf_netbsdkintf.c Log Message: Add a SET_LAST_UNIT ioctl. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/raidframeio.h cvs rdiff -u -r1.340 -r1.341 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/raidframeio.h diff -u src/sys/dev/raidframe/raidframeio.h:1.6 src/sys/dev/raidframe/raidframeio.h:1.7 --- src/sys/dev/raidframe/raidframeio.h:1.6 Tue Nov 17 13:54:26 2009 +++ src/sys/dev/raidframe/raidframeio.h Wed Jan 6 12:40:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: raidframeio.h,v 1.6 2009/11/17 18:54:26 jld Exp $ */ +/* $NetBSD: raidframeio.h,v 1.7 2016/01/06 17:40:50 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -131,5 +131,6 @@ #define RAIDFRAME_PARITYMAP_GET_DISABLE _IOR('r', 38, int) #define RAIDFRAME_PARITYMAP_SET_DISABLE _IOW('r', 39, int) #define RAIDFRAME_PARITYMAP_SET_PARAMS _IOW('r', 40, struct rf_pmparams) +#define RAIDFRAME_SET_LAST_UNIT _IOW('r', 41, int) #endif/* !_RF_RAIDFRAMEIO_H_ */ Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.340 src/sys/dev/raidframe/rf_netbsdkintf.c:1.341 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.340 Tue Jan 5 13:44:34 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Jan 6 12:40:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.340 2016/01/05 18:44:34 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.341 2016/01/06 17:40:50 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.340 2016/01/05 18:44:34 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.341 2016/01/06 17:40:50 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -259,13 +259,14 @@ struct raid_softc { LIST_ENTRY(raid_softc) sc_link; }; /* sc_flags */ -#define RAIDF_INITED 0x01 /* unit has been initialized */ -#define RAIDF_WLABEL 0x02 /* label area is writable */ -#define RAIDF_LABELLING 0x04 /* unit is currently being labelled */ -#define RAIDF_SHUTDOWN 0x08 /* unit is being shutdown */ -#define RAIDF_DETACH 0x10 /* detach after final close */ -#define RAIDF_WANTED 0x40 /* someone is waiting to obtain a lock */ -#define RAIDF_LOCKED 0x80 /* unit is locked */ +#define RAIDF_INITED 0x001 /* unit has been initialized */ +#define RAIDF_WLABEL 0x002 /* label area is writable */ +#define RAIDF_LABELLING 0x004 /* unit is currently being labelled */ +#define RAIDF_SHUTDOWN 0x008 /* unit is being shutdown */ +#define RAIDF_DETACH 0x010 /* detach after final close */ +#define RAIDF_WANTED 0x040 /* someone is waiting to obtain a lock */ +#define RAIDF_LOCKED 0x080 /* unit is locked */ +#define RAIDF_UNIT_CHANGED 0x100 /* unit is being changed */ #define raidunit(x) DISKUNIT(x) #define raidsoftc(dev) (((struct raid_softc *)device_private(dev))->sc_r.softc) @@ -1676,6 +1677,19 @@ raidioctl(dev_t dev, u_long cmd, void *d sizeof(RF_ProgressInfo_t)); return (retcode); + case RAIDFRAME_SET_LAST_UNIT: + for (column = 0; column < raidPtr->numCol; column++) + if (raidPtr->Disks[column].status != rf_ds_optimal) +return EBUSY; + + for (column = 0; column < raidPtr->numCol; column++) { + clabel = raidget_component_label(raidPtr, column); + clabel->last_unit = *(int *)data; + raidflush_component_label(raidPtr, column); + } + rs->sc_cflags |= RAIDF_UNIT_CHANGED; + return 0; + /* the sparetable daemon calls this to wait for the kernel to * need a spare table. this ioctl does not return until a * spare table is needed. XXX -- calling mpsleep here in the @@ -2491,6 +2505,7 @@ rf_update_component_labels(RF_Raid_t *ra int c; int j; int scol; + struct raid_softc *rs = raidPtr->softc; scol = -1; @@ -2506,7 +2521,8 @@ rf_update_component_labels(RF_Raid_t *ra clabel->status = rf_ds_optimal; /* note what unit we are configured as */ - clabel->last_unit = raidPtr->raidid; + if ((rs->sc_cflags & RAIDF_UNIT_CHANGED) == 0) +clabel->last_unit = raidPtr->raidid; raidflush_component_label(raidPtr, c); if (final == RF_FINAL_COMPONENT_UPDATE) { @@ -2546,7 +2562,8 @@ rf_update_component_labels(RF_Raid_t *ra clabel->column = scol; clabel->status = rf_ds_optimal; - clabel->last_unit = raidPtr->raidid; + if ((rs->sc_cflags & RAIDF_UNIT_CHANGED) == 0) +clabel->last_unit = raidPtr->raidid; raidflush_component_label(raidPtr, sparecol); if (final == RF_FINAL_COMPONENT_UPDATE) {
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Tue Jan 5 18:44:34 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: revert bp->b_error checking; biowait() is a no-op in that case and it is valid to call biowait() after biodone. (thanks chuq) To generate a diff of this commit: cvs rdiff -u -r1.339 -r1.340 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.339 src/sys/dev/raidframe/rf_netbsdkintf.c:1.340 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.339 Tue Jan 5 12:06:34 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Jan 5 13:44:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.339 2016/01/05 17:06:34 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.340 2016/01/05 18:44:34 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.339 2016/01/05 17:06:34 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.340 2016/01/05 18:44:34 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -2323,9 +2323,7 @@ raidread_component_area(dev_t dev, struc bp->b_resid = dsize; bdev_strategy(bp); - error = bp->b_error; - if (!error) - error = biowait(bp); + error = biowait(bp); if (!error) { memcpy(data, bp->b_data, msize); @@ -2370,9 +2368,7 @@ raidwrite_component_area(dev_t dev, stru bdev_strategy(bp); if (asyncp) return 0; - error = bp->b_error; - if (!error) - error = biowait(bp); + error = biowait(bp); brelse(bp, 0); if (error) { #if 1
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Tue Jan 5 17:06:34 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: When autoconfiguring RAID sets: Pseudo devices like vnd and cgd can be opened but may still need some configuration. Ignore these quietly. To generate a diff of this commit: cvs rdiff -u -r1.338 -r1.339 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.338 src/sys/dev/raidframe/rf_netbsdkintf.c:1.339 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.338 Tue Jan 5 17:03:53 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Jan 5 17:06:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.338 2016/01/05 17:03:53 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.339 2016/01/05 17:06:34 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.338 2016/01/05 17:03:53 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.339 2016/01/05 17:06:34 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -2840,8 +2840,15 @@ rf_find_raid_components(void) error = getdisksize(vp, &numsecs, &secsize); if (error) { -printf("RAIDframe: can't get disk size for " -"dev %s (%d)\n", device_xname(dv), error); +/* + * Pseudo devices like vnd and cgd can be + * opened but may still need some configuration. + * Ignore these quietly. + */ +if (error != ENXIO) + printf("RAIDframe: can't get disk size" + " for dev %s (%d)\n", + device_xname(dv), error); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); VOP_CLOSE(vp, FREAD | FWRITE, NOCRED); vput(vp);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Tue Jan 5 17:03:53 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: handle possible errors from bdev_strategy. To generate a diff of this commit: cvs rdiff -u -r1.337 -r1.338 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.337 src/sys/dev/raidframe/rf_netbsdkintf.c:1.338 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.337 Mon Jan 4 13:15:17 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Jan 5 17:03:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.337 2016/01/04 13:15:17 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.338 2016/01/05 17:03:53 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.337 2016/01/04 13:15:17 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.338 2016/01/05 17:03:53 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -2323,7 +2323,9 @@ raidread_component_area(dev_t dev, struc bp->b_resid = dsize; bdev_strategy(bp); - error = biowait(bp); + error = bp->b_error; + if (!error) + error = biowait(bp); if (!error) { memcpy(data, bp->b_data, msize); @@ -2368,7 +2370,9 @@ raidwrite_component_area(dev_t dev, stru bdev_strategy(bp); if (asyncp) return 0; - error = biowait(bp); + error = bp->b_error; + if (!error) + error = biowait(bp); brelse(bp, 0); if (error) { #if 1
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Mon Jan 4 13:15:17 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: prevent unconfigure/detach while background threads are running. To generate a diff of this commit: cvs rdiff -u -r1.336 -r1.337 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.336 src/sys/dev/raidframe/rf_netbsdkintf.c:1.337 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.336 Mon Jan 4 11:12:40 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Jan 4 13:15:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.337 2016/01/04 13:15:17 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.337 2016/01/04 13:15:17 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -967,7 +967,10 @@ raid_detach_unlocked(struct raid_softc * raidPtr = &rs->sc_r; - if (DK_BUSY(dksc, 0)) + if (DK_BUSY(dksc, 0) || + raidPtr->recon_in_progress != 0 || + raidPtr->parity_rewrite_in_progress != 0 || + raidPtr->copyback_in_progress != 0) return EBUSY; if ((rs->sc_flags & RAIDF_INITED) == 0) @@ -1180,7 +1183,10 @@ raidioctl(dev_t dev, u_long cmd, void *d if ((error = raidlock(rs)) != 0) return (error); - if (DK_BUSY(dksc, pmask)) + if (DK_BUSY(dksc, pmask) || + raidPtr->recon_in_progress != 0 || + raidPtr->parity_rewrite_in_progress != 0 || + raidPtr->copyback_in_progress != 0) retcode = EBUSY; else { /* detach and free on close */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Mon Jan 4 11:12:40 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Fix dump on raid. - offset dump by RF_PROTECTED_SECTORS (thanks oster@ for noticing) - call component dump function with byte count instead of block count - return -1 instead of errno values in dk_size for error conditions. There are still issues with dumping. - the raid device must be open, neither reading the disklabel nor flushing the component labels in rfmarkdirty is possible when dumping. - dumping to a wedge component fails because the wedge driver only allows dumping to swap partitions, not raid partitions. To generate a diff of this commit: cvs rdiff -u -r1.335 -r1.336 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.335 src/sys/dev/raidframe/rf_netbsdkintf.c:1.336 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.335 Sun Jan 3 08:17:24 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Jan 4 11:12:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -598,11 +598,11 @@ raidsize(dev_t dev) unit = raidunit(dev); if ((rs = raidget(unit, false)) == NULL) - return ENXIO; + return -1; dksc = &rs->sc_dksc; if ((rs->sc_flags & RAIDF_INITED) == 0) - return (ENODEV); + return -1; return dk_size(dksc, dev); } @@ -622,6 +622,13 @@ raiddump(dev_t dev, daddr_t blkno, void if ((rs->sc_flags & RAIDF_INITED) == 0) return ENODEV; +/* + Note that blkno is relative to this particular partition. + By adding adding RF_PROTECTED_SECTORS, we get a value that + is relative to the partition used for the underlying component. +*/ + blkno += RF_PROTECTED_SECTORS; + return dk_dump(dksc, dev, blkno, va, size); } @@ -719,7 +726,7 @@ raid_dumpblocks(device_t dev, void *va, bdev = bdevsw_lookup(raidPtr->Disks[dumpto].dev); error = (*bdev->d_dump)(raidPtr->Disks[dumpto].dev, -blkno, va, nblk); +blkno, va, nblk * raidPtr->bytesPerSector); out: raidunlock(rs);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Sun Jan 3 08:17:24 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_engine.c rf_kintf.h rf_netbsdkintf.c rf_states.c Log Message: refactor driver to use common code in dksubr. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/raidframe/rf_engine.c cvs rdiff -u -r1.23 -r1.24 src/sys/dev/raidframe/rf_kintf.h cvs rdiff -u -r1.334 -r1.335 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.49 -r1.50 src/sys/dev/raidframe/rf_states.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_engine.c diff -u src/sys/dev/raidframe/rf_engine.c:1.50 src/sys/dev/raidframe/rf_engine.c:1.51 --- src/sys/dev/raidframe/rf_engine.c:1.50 Sat Oct 18 08:33:28 2014 +++ src/sys/dev/raidframe/rf_engine.c Sun Jan 3 08:17:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_engine.c,v 1.50 2014/10/18 08:33:28 snj Exp $ */ +/* $NetBSD: rf_engine.c,v 1.51 2016/01/03 08:17:24 mlelstv Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -55,7 +55,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.50 2014/10/18 08:33:28 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.51 2016/01/03 08:17:24 mlelstv Exp $"); #include @@ -843,7 +843,7 @@ DAGExecutionThread(RF_ThreadArg_t arg) /* * rf_RaidIOThread() -- When I/O to a component begins, raidstrategy() - * puts the I/O on a buf_queue, and then signals raidPtr->iodone. If + * puts the I/O on a buffer queue, and then signals raidPtr->iodone. If * necessary, this function calls raidstart() to initiate the I/O. * When I/O to a component completes, KernelWakeupFunc() puts the * completed request onto raidPtr->iodone TAILQ. This function looks Index: src/sys/dev/raidframe/rf_kintf.h diff -u src/sys/dev/raidframe/rf_kintf.h:1.23 src/sys/dev/raidframe/rf_kintf.h:1.24 --- src/sys/dev/raidframe/rf_kintf.h:1.23 Wed Aug 3 14:44:38 2011 +++ src/sys/dev/raidframe/rf_kintf.h Sun Jan 3 08:17:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_kintf.h,v 1.23 2011/08/03 14:44:38 oster Exp $ */ +/* $NetBSD: rf_kintf.h,v 1.24 2016/01/03 08:17:24 mlelstv Exp $ */ /* * rf_kintf.h * @@ -42,6 +42,7 @@ int rf_reasonable_label(RF_ComponentLabe voidraidstart(RF_Raid_t * raidPtr); int rf_DispatchKernelIO(RF_DiskQueue_t * queue, RF_DiskQueueData_t * req); +voidraiddone(RF_Raid_t * raidPtr, struct buf * bp); int raidfetch_component_label(RF_Raid_t *, RF_RowCol_t); RF_ComponentLabel_t *raidget_component_label(RF_Raid_t *, RF_RowCol_t); @@ -59,7 +60,6 @@ void raid_init_component_label(RF_Raid_t void rf_print_component_label(RF_ComponentLabel_t *); void rf_UnconfigureVnodes( RF_Raid_t * ); void rf_close_component( RF_Raid_t *, struct vnode *, int); -void rf_disk_unbusy(RF_RaidAccessDesc_t *); int rf_getdisksize(struct vnode *, RF_RaidDisk_t *); int rf_sync_component_caches(RF_Raid_t *raidPtr); #endif/* _RF__RF_KINTF_H_ */ Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.334 src/sys/dev/raidframe/rf_netbsdkintf.c:1.335 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.334 Sat Jan 2 16:20:50 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Jan 3 08:17:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.334 2016/01/02 16:20:50 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.334 2016/01/02 16:20:50 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -181,6 +181,7 @@ static void InitBP(struct buf *, struct void *, int, struct proc *); struct raid_softc; static void raidinit(struct raid_softc *); +static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp); static int raid_match(device_t, cfdata_t, void *); static void raid_attach(device_t, device_t, void *); @@ -196,6 +197,9 @@ static int raidwrite_component_label(uns static int raidread_component_label(unsigned, dev_t, struct vnode *, RF_ComponentLabel_t *); +static int raid_diskstart(device_t, struct buf *bp); +static int raid_dumpblocks(device_t, void *, daddr_t, int); +static int raid_lastclose(device_t); static dev_type_open(raidopen); static dev_type_close(raidclose); @@ -233,12 +237,17 @@ const struct cdevsw raid_cdevsw = { }; static struct dkdriver rf_dkdriver = { + .d_open = raidopen, + .d_close = raidclose, .d_strategy = raidstrategy, + .d_diskstart = raid_diskstart, + .d_dumpblocks = raid_dumpblocks, + .d_lastclose = raid_la
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Sat Jan 2 16:20:50 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: No longer detach opened device directly in RAIDFRAME_SHUTDOWN ioctl, instead just mark the device for shutdown and detach on last close. Also don't manually print the detached message but leave this to config_detach(). This avoids a duplicate message when shutting down. To generate a diff of this commit: cvs rdiff -u -r1.333 -r1.334 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.333 src/sys/dev/raidframe/rf_netbsdkintf.c:1.334 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.333 Sat Jan 2 16:10:06 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Jan 2 16:20:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.333 2016/01/02 16:10:06 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.334 2016/01/02 16:20:50 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.333 2016/01/02 16:10:06 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.334 2016/01/02 16:20:50 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -891,7 +891,7 @@ raidclose(dev_t dev, int flags, int fmt, cf = device_cfdata(rs->sc_dev); raidunlock(rs); - retcode = config_detach(rs->sc_dev, DETACH_QUIET); + retcode = config_detach(rs->sc_dev, 0); if (retcode == 0) /* free the pseudo device attach bits */ free(cf, M_RAIDFRAME); @@ -1040,9 +1040,6 @@ raid_detach_unlocked(struct raid_softc * rs->sc_flags &= ~RAIDF_INITED; - /* Free the softc */ - aprint_normal_dev(rs->sc_dev, "detached\n"); - return 0; } @@ -1052,7 +1049,6 @@ raidioctl(dev_t dev, u_long cmd, void *d int unit = raidunit(dev); int error = 0; int part, pmask, s; - cfdata_t cf; struct raid_softc *rs; RF_Config_t *k_cfg, *u_cfg; RF_Raid_t *raidPtr; @@ -1127,7 +1123,6 @@ raidioctl(dev_t dev, u_long cmd, void *d case DIOCLWEDGES: case DIOCMWEDGES: case DIOCCACHESYNC: - case RAIDFRAME_SHUTDOWN: case RAIDFRAME_REWRITEPARITY: case RAIDFRAME_GET_INFO: case RAIDFRAME_RESET_ACCTOTALS: @@ -1286,23 +1281,11 @@ raidioctl(dev_t dev, u_long cmd, void *d retcode = EBUSY; else { rs->sc_flags |= RAIDF_SHUTDOWN; - rs->sc_dkdev.dk_copenmask &= ~pmask; - rs->sc_dkdev.dk_bopenmask &= ~pmask; - rs->sc_dkdev.dk_openmask &= ~pmask; retcode = 0; } raidunlock(rs); - if (retcode != 0) - return retcode; - - /* free the pseudo device attach bits */ - - cf = device_cfdata(rs->sc_dev); - if ((retcode = config_detach(rs->sc_dev, DETACH_QUIET)) == 0) - free(cf, M_RAIDFRAME); - return (retcode); case RAIDFRAME_GET_COMPONENT_LABEL: clabel_ptr = (RF_ComponentLabel_t **) data;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Sat Jan 2 16:10:06 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: RAIDF_INITED state also includes disk attachments, don't undo operations that haven't been committed. To generate a diff of this commit: cvs rdiff -u -r1.332 -r1.333 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.332 src/sys/dev/raidframe/rf_netbsdkintf.c:1.333 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.332 Sat Jan 2 16:06:25 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Jan 2 16:10:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.332 2016/01/02 16:06:25 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.333 2016/01/02 16:10:06 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.332 2016/01/02 16:06:25 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.333 2016/01/02 16:10:06 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1026,17 +1026,20 @@ raid_detach_unlocked(struct raid_softc * return EBUSY; if ((rs->sc_flags & RAIDF_INITED) == 0) - ; /* not initialized: nothing to do */ - else if ((error = rf_Shutdown(raidPtr)) != 0) + return 0; + + rs->sc_flags &= ~RAIDF_SHUTDOWN; + + if ((error = rf_Shutdown(raidPtr)) != 0) return error; - else - rs->sc_flags &= ~(RAIDF_INITED|RAIDF_SHUTDOWN); /* Detach the disk. */ dkwedge_delall(&rs->sc_dkdev); disk_detach(&rs->sc_dkdev); disk_destroy(&rs->sc_dkdev); + rs->sc_flags &= ~RAIDF_INITED; + /* Free the softc */ aprint_normal_dev(rs->sc_dev, "detached\n");
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Sat Jan 2 16:06:25 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Unlock and free in raid_detach to handle error paths. To generate a diff of this commit: cvs rdiff -u -r1.331 -r1.332 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.331 src/sys/dev/raidframe/rf_netbsdkintf.c:1.332 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.331 Sat Jan 2 16:00:01 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Jan 2 16:06:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.331 2016/01/02 16:00:01 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.332 2016/01/02 16:06:25 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.331 2016/01/02 16:00:01 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.332 2016/01/02 16:06:25 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1039,8 +1039,6 @@ raid_detach_unlocked(struct raid_softc * /* Free the softc */ aprint_normal_dev(rs->sc_dev, "detached\n"); - raidunlock(rs); - raidput(rs); return 0; } @@ -3930,7 +3928,17 @@ raid_detach(device_t self, int flags) error = raid_detach_unlocked(rs); - return error; + raidunlock(rs); + + /* XXX raid can be referenced here */ + + if (error) + return error; + + /* Free the softc */ + raidput(rs); + + return 0; } static void
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mlelstv Date: Sat Jan 2 16:00:01 UTC 2016 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: use bdev_strategy wrapper to properly use KERNEL_LOCK. To generate a diff of this commit: cvs rdiff -u -r1.330 -r1.331 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.330 src/sys/dev/raidframe/rf_netbsdkintf.c:1.331 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.330 Sat Dec 26 21:50:43 2015 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Jan 2 16:00:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.330 2015/12/26 21:50:43 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.331 2016/01/02 16:00:01 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.330 2015/12/26 21:50:43 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.331 2016/01/02 16:00:01 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -2643,7 +2643,6 @@ raidread_component_area(dev_t dev, struc size_t msize, daddr_t offset, daddr_t dsize) { struct buf *bp; - const struct bdevsw *bdev; int error; /* XXX should probably ensure that we don't try to do this if @@ -2665,11 +2664,7 @@ raidread_component_area(dev_t dev, struc bp->b_flags |= B_READ; bp->b_resid = dsize; - bdev = bdevsw_lookup(bp->b_dev); - if (bdev == NULL) - return (ENXIO); - (*bdev->d_strategy)(bp); - + bdev_strategy(bp); error = biowait(bp); if (!error) { @@ -2697,7 +2692,6 @@ raidwrite_component_area(dev_t dev, stru size_t msize, daddr_t offset, daddr_t dsize, int asyncp) { struct buf *bp; - const struct bdevsw *bdev; int error; /* get a block of the appropriate size... */ @@ -2713,10 +2707,7 @@ raidwrite_component_area(dev_t dev, stru memset(bp->b_data, 0, dsize); memcpy(bp->b_data, data, msize); - bdev = bdevsw_lookup(bp->b_dev); - if (bdev == NULL) - return (ENXIO); - (*bdev->d_strategy)(bp); + bdev_strategy(bp); if (asyncp) return 0; error = biowait(bp);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: pgoyette Date: Sat Dec 26 21:50:43 UTC 2015 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Another use-after-free() To generate a diff of this commit: cvs rdiff -u -r1.329 -r1.330 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.329 src/sys/dev/raidframe/rf_netbsdkintf.c:1.330 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.329 Sat Dec 26 12:59:00 2015 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Dec 26 21:50:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.329 2015/12/26 12:59:00 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.330 2015/12/26 21:50:43 pgoyette Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.329 2015/12/26 12:59:00 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.330 2015/12/26 21:50:43 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1039,6 +1039,7 @@ raid_detach_unlocked(struct raid_softc * /* Free the softc */ aprint_normal_dev(rs->sc_dev, "detached\n"); + raidunlock(rs); raidput(rs); return 0; @@ -3938,9 +3939,6 @@ raid_detach(device_t self, int flags) error = raid_detach_unlocked(rs); - if (error != 0) - raidunlock(rs); - return error; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: pgoyette Date: Sat Dec 26 12:59:01 UTC 2015 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: If the "finalizer" should fail to register for any reason, just report the situation (as a WARNING) and continue. Don't return the error code to the caller. Failure to register should not really happen - if it does, all we really lose is auto-configuration of raid-sets. To generate a diff of this commit: cvs rdiff -u -r1.328 -r1.329 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.328 src/sys/dev/raidframe/rf_netbsdkintf.c:1.329 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.328 Sat Dec 26 12:25:26 2015 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Dec 26 12:59:00 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.328 2015/12/26 12:25:26 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.329 2015/12/26 12:59:00 pgoyette Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.328 2015/12/26 12:25:26 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.329 2015/12/26 12:59:00 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -4106,6 +4106,7 @@ raid_modcmd_init(void) if (error != 0) { aprint_error("WARNING: unable to register RAIDframe " "finalizer\n"); + error = 0; } return error;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: pgoyette Date: Sat Dec 26 12:25:26 UTC 2015 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Resolve a use-after-free reference to the softc. From mlelstv@ To generate a diff of this commit: cvs rdiff -u -r1.327 -r1.328 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.327 src/sys/dev/raidframe/rf_netbsdkintf.c:1.328 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.327 Sat Dec 26 00:58:45 2015 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Dec 26 12:25:26 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.327 2015/12/26 00:58:45 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.328 2015/12/26 12:25:26 pgoyette Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.327 2015/12/26 00:58:45 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.328 2015/12/26 12:25:26 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1038,9 +1038,8 @@ raid_detach_unlocked(struct raid_softc * disk_destroy(&rs->sc_dkdev); /* Free the softc */ - raidput(rs); - aprint_normal_dev(rs->sc_dev, "detached\n"); + raidput(rs); return 0; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: pgoyette Date: Sat Dec 26 00:58:45 UTC 2015 Modified Files: src/sys/dev/raidframe: rf_driver.c rf_driver.h rf_netbsdkintf.c Log Message: Modularize the raidframe driver, including rework of the unit attach code to permit detaching (and possible module unloading). Also, convert tsleep()/wakeup() locking to use cv_wait_sig()/cv_broadcast(). Tested in non-modular, modular-builtin, and modular-loaded-at-runtime environments. To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/rf_driver.h cvs rdiff -u -r1.326 -r1.327 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_driver.c diff -u src/sys/dev/raidframe/rf_driver.c:1.131 src/sys/dev/raidframe/rf_driver.c:1.132 --- src/sys/dev/raidframe/rf_driver.c:1.131 Mon Dec 10 08:36:03 2012 +++ src/sys/dev/raidframe/rf_driver.c Sat Dec 26 00:58:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.131 2012/12/10 08:36:03 msaitoh Exp $ */ +/* $NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.131 2012/12/10 08:36:03 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -158,16 +158,21 @@ static void rf_alloc_mutex_cond(RF_Raid_ /* called at system boot time */ int -rf_BootRaidframe(void) +rf_BootRaidframe(bool boot) { - if (raidframe_booted) - return (EBUSY); - raidframe_booted = 1; - rf_init_mutex2(configureMutex, IPL_NONE); - configureCount = 0; - isconfigged = 0; - globalShutdown = NULL; + if (boot) { + if (raidframe_booted) + return (EBUSY); + raidframe_booted = 1; + rf_init_mutex2(configureMutex, IPL_NONE); + configureCount = 0; + isconfigged = 0; + globalShutdown = NULL; + } else { + rf_destroy_mutex2(configureMutex); + raidframe_booted = 0; + } return (0); } Index: src/sys/dev/raidframe/rf_driver.h diff -u src/sys/dev/raidframe/rf_driver.h:1.19 src/sys/dev/raidframe/rf_driver.h:1.20 --- src/sys/dev/raidframe/rf_driver.h:1.19 Sat Apr 30 01:44:36 2011 +++ src/sys/dev/raidframe/rf_driver.h Sat Dec 26 00:58:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.h,v 1.19 2011/04/30 01:44:36 mrg Exp $ */ +/* $NetBSD: rf_driver.h,v 1.20 2015/12/26 00:58:45 pgoyette Exp $ */ /* * rf_driver.h */ @@ -42,7 +42,7 @@ #endif extern rf_declare_mutex2(rf_printf_mutex); -int rf_BootRaidframe(void); +int rf_BootRaidframe(bool); int rf_UnbootRaidframe(void); int rf_Shutdown(RF_Raid_t *); int rf_Configure(RF_Raid_t *, RF_Config_t *, RF_AutoConfig_t *); Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.326 src/sys/dev/raidframe/rf_netbsdkintf.c:1.327 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.326 Tue Dec 8 20:36:15 2015 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Dec 26 00:58:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.326 2015/12/08 20:36:15 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.327 2015/12/26 00:58:45 pgoyette Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.326 2015/12/08 20:36:15 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.327 2015/12/26 00:58:45 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -126,6 +126,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkin #include #include #include +#include #include @@ -241,6 +242,8 @@ struct raid_softc { int sc_unit; int sc_flags; /* flags */ int sc_cflags; /* configuration flags */ + kmutex_t sc_mutex; /* interlock mutex */ + kcondvar_t sc_cv; /* and the condvar */ uint64_t sc_size; /* size of the raid device */ charsc_xname[20]; /* XXX external name */ struct disk sc_dkdev; /* generic disk device info */ @@ -350,17 +353,21 @@ raidcreate(int unit) { } sc->sc_unit = unit; bufq_alloc(&sc->buf_queue, "fcfs", BUFQ_SORT_RAWBLOCK); + cv_init(&sc->sc_cv, "raidunit"); + mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_NONE); return sc; } static void raiddestroy(struct raid_softc *sc) { + cv_destroy(&sc->sc_cv); + mutex_destroy(&sc->sc_mutex); bufq_free(sc->buf_queue); kmem_free(sc, sizeof(*sc)); } static struct raid_softc * -raidget(int unit) { +raidget(int unit, bool create) { struct raid_softc *sc; if (unit < 0) { #ifdef DIAGNOSTIC @@ -376,6 +383,8 @@ raidget(int unit) { } } mutex_exit(&raid_lock); + if (!create) + return NULL; if ((sc = raidcreate(unit)) == NULL) retu
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: mrg Date: Fri Jul 10 09:49:56 UTC 2015 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: mark all the device entry points static. To generate a diff of this commit: cvs rdiff -u -r1.323 -r1.324 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.323 src/sys/dev/raidframe/rf_netbsdkintf.c:1.324 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.323 Sun Apr 26 15:15:20 2015 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Jul 10 09:49:56 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.323 2015/04/26 15:15:20 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.324 2015/07/10 09:49:56 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.323 2015/04/26 15:15:20 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.324 2015/07/10 09:49:56 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -195,14 +195,14 @@ static int raidread_component_label(unsi dev_t, struct vnode *, RF_ComponentLabel_t *); -dev_type_open(raidopen); -dev_type_close(raidclose); -dev_type_read(raidread); -dev_type_write(raidwrite); -dev_type_ioctl(raidioctl); -dev_type_strategy(raidstrategy); -dev_type_dump(raiddump); -dev_type_size(raidsize); +static dev_type_open(raidopen); +static dev_type_close(raidclose); +static dev_type_read(raidread); +static dev_type_write(raidwrite); +static dev_type_ioctl(raidioctl); +static dev_type_strategy(raidstrategy); +static dev_type_dump(raiddump); +static dev_type_size(raidsize); const struct bdevsw raid_bdevsw = { .d_open = raidopen, @@ -597,8 +597,7 @@ rf_buildroothack(RF_ConfigSet_t *config_ } } - -int +static int raidsize(dev_t dev) { struct raid_softc *rs; @@ -631,7 +630,7 @@ raidsize(dev_t dev) } -int +static int raiddump(dev_t dev, daddr_t blkno, void *va, size_t size) { int unit = raidunit(dev); @@ -767,8 +766,9 @@ out: return error; } + /* ARGSUSED */ -int +static int raidopen(dev_t dev, int flags, int fmt, struct lwp *l) { @@ -852,8 +852,9 @@ bad: } + /* ARGSUSED */ -int +static int raidclose(dev_t dev, int flags, int fmt, struct lwp *l) { int unit = raidunit(dev); @@ -902,7 +903,7 @@ raidclose(dev_t dev, int flags, int fmt, } -void +static void raidstrategy(struct buf *bp) { unsigned int unit = raidunit(bp->b_dev); @@ -972,8 +973,9 @@ done: bp->b_resid = bp->b_bcount; biodone(bp); } + /* ARGSUSED */ -int +static int raidread(dev_t dev, struct uio *uio, int flags) { int unit = raidunit(dev); @@ -988,8 +990,9 @@ raidread(dev_t dev, struct uio *uio, int return (physio(raidstrategy, NULL, dev, B_READ, minphys, uio)); } + /* ARGSUSED */ -int +static int raidwrite(dev_t dev, struct uio *uio, int flags) { int unit = raidunit(dev); @@ -1037,7 +1040,7 @@ raid_detach_unlocked(struct raid_softc * return 0; } -int +static int raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) { int unit = raidunit(dev);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: prlw1 Date: Sat Jan 3 11:48:04 UTC 2015 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Also print b_error in the IO Error message To generate a diff of this commit: cvs rdiff -u -r1.321 -r1.322 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.321 src/sys/dev/raidframe/rf_netbsdkintf.c:1.322 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.321 Fri Jan 2 19:42:07 2015 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sat Jan 3 11:48:04 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.321 2015/01/02 19:42:07 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.322 2015/01/03 11:48:04 prlw1 Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.321 2015/01/02 19:42:07 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.322 2015/01/03 11:48:04 prlw1 Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -2279,8 +2279,9 @@ KernelWakeupFunc(struct buf *bp) rf_ds_used_spare)) && (queue->raidPtr->numFailures < queue->raidPtr->Layout.map->faultsTolerated)) { - printf("raid%d: IO Error. Marking %s as failed.\n", + printf("raid%d: IO Error (%d). Marking %s as failed.\n", queue->raidPtr->raidid, + bp->b_error, queue->raidPtr->Disks[queue->col].devname); queue->raidPtr->Disks[queue->col].status = rf_ds_failed;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: taca Date: Sun Dec 21 17:04:12 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Stop useless disklabel warning if there are wedges, using GPT partition. Fix PR kern/47989. XXX: Pullup 6 and 7 (maybe 5) To generate a diff of this commit: cvs rdiff -u -r1.316 -r1.317 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.316 src/sys/dev/raidframe/rf_netbsdkintf.c:1.317 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.316 Fri Nov 14 14:29:16 2014 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Dec 21 17:04:12 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.316 2014/11/14 14:29:16 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.317 2014/12/21 17:04:12 taca Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.316 2014/11/14 14:29:16 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.317 2014/12/21 17:04:12 taca Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -800,6 +800,7 @@ raidopen(dev_t dev, int flags, int fmt, pmask = (1 << part); if ((rs->sc_flags & RAIDF_INITED) && + (rs->sc_dkdev.dk_nwedges == 0) && (rs->sc_dkdev.dk_openmask == 0)) raidgetdisklabel(dev);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Nov 14 14:45:34 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_map.c Log Message: Adjust comment to reflect reality. (5th arg, not 4th) To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/raidframe/rf_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_map.c diff -u src/sys/dev/raidframe/rf_map.c:1.45 src/sys/dev/raidframe/rf_map.c:1.46 --- src/sys/dev/raidframe/rf_map.c:1.45 Wed May 11 18:13:12 2011 +++ src/sys/dev/raidframe/rf_map.c Fri Nov 14 14:45:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_map.c,v 1.45 2011/05/11 18:13:12 mrg Exp $ */ +/* $NetBSD: rf_map.c,v 1.46 2014/11/14 14:45:34 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ **/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.45 2011/05/11 18:13:12 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_map.c,v 1.46 2014/11/14 14:45:34 oster Exp $"); #include @@ -848,7 +848,7 @@ rf_ASMParityAdjust(RF_PhysDiskAddr_t *to } /* Check if a disk has been spared or failed. If spared, redirect the - * I/O. If it has been failed, record it in the asm pointer. Fourth + * I/O. If it has been failed, record it in the asm pointer. Fifth * arg is whether data or parity. */ void rf_ASMCheckStatus(RF_Raid_t *raidPtr, RF_PhysDiskAddr_t *pda_p,
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Nov 14 14:29:16 UTC 2014 Modified Files: src/sys/dev/raidframe: raidframevar.h rf_netbsdkintf.c rf_reconstruct.c Log Message: Fix a long-standing bug related to rebooting while a reconstruct-to-spare is underway but not yet complete. The issue was that a component was being marked as a used_spare when the rebuild started, not when the rebuild was actually finished. Marking it as a used_spare meant that the component label on the spare was being updated such that after a reboot the component would be considered up-to-date, regardless of whether the rebuild actually completed! This fix includes: 1) Add an additional state "rf_ds_rebuilding_spare" which is used to denote that a spare is currently being rebuilt from the live components. 2) Update the comments on the disk states, which were out-of-sync with reality. 3) When rebuilding to a spare component, that spare now enters the state rf_ds_rebuilding_spare instead of the state rf_ds_used_spare. 4) When the rebuild is actually complete then the spare component enters the rf_ds_used_spare state. rf_ds_used_spare is now used exclusively for the case where the rebuilding to the spare has completed successfully. XXX: Someday we need to teach raidctl(8) about this new state, and take out the backwards compatibility code in rf_netbsdkintf.c (see RAIDFRAME_GET_INFO in raidioctl()). For today, this fix needs to be generic enough that it can get backported without major grief. XXX: Needs pullup to netbsd-5*, netbsd-6*, and netbsd-7 Fixes PR#49244. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/raidframevar.h cvs rdiff -u -r1.315 -r1.316 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.120 -r1.121 src/sys/dev/raidframe/rf_reconstruct.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/raidframevar.h diff -u src/sys/dev/raidframe/raidframevar.h:1.16 src/sys/dev/raidframe/raidframevar.h:1.17 --- src/sys/dev/raidframe/raidframevar.h:1.16 Fri Feb 28 10:16:51 2014 +++ src/sys/dev/raidframe/raidframevar.h Fri Nov 14 14:29:16 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: raidframevar.h,v 1.16 2014/02/28 10:16:51 skrll Exp $ */ +/* $NetBSD: raidframevar.h,v 1.17 2014/11/14 14:29:16 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -383,17 +383,17 @@ struct RF_SparetWait_s { * IF YOU ADD A STATE, CHECK TO SEE IF YOU NEED TO MODIFY RF_DEAD_DISK(). */ enum RF_DiskStatus_e { -rf_ds_optimal, /* no problems */ -rf_ds_failed, /* reconstruction ongoing */ -rf_ds_reconstructing, /* reconstruction complete to spare, dead disk - * not yet replaced */ -rf_ds_dist_spared, /* reconstruction complete to distributed + rf_ds_optimal, /* no problems */ + rf_ds_failed, /* disk has failed */ + rf_ds_reconstructing, /* reconstruction ongoing */ + rf_ds_dist_spared, /* reconstruction complete to distributed * spare space, dead disk not yet replaced */ -rf_ds_spared, /* reconstruction complete to distributed - * spare space, dead disk not yet replaced */ -rf_ds_spare,/* an available spare disk */ -rf_ds_used_spare/* a spare which has been used, and hence is + rf_ds_spared, /* reconstruction complete, dead disk not + yet replaced */ + rf_ds_spare,/* an available spare disk */ + rf_ds_used_spare, /* a spare which has been used, and hence is * not available */ + rf_ds_rebuilding_spare /* a spare which is being rebuilt to */ }; typedef enum RF_DiskStatus_e RF_DiskStatus_t; Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.315 src/sys/dev/raidframe/rf_netbsdkintf.c:1.316 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.315 Tue Nov 4 07:51:55 2014 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Nov 14 14:29:16 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.315 2014/11/04 07:51:55 mlelstv Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.316 2014/11/14 14:29:16 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.315 2014/11/04 07:51:55 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.316 2014/11/14 14:29:16 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1532,6 +1532,10 @@ raidioctl(dev_t dev, u_long cmd, void *d } for (j = d_cfg->cols, i = 0; i < d_cfg->nspares; i++, j++) { d_cfg->spares[i] = raidPtr->Disks
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Mon May 12 15:53:01 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: restore defaulting to the 'a' partition for booting with root on raid as it was before, and explain why we do things this way. To generate a diff of this commit: cvs rdiff -u -r1.309 -r1.310 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.309 src/sys/dev/raidframe/rf_netbsdkintf.c:1.310 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.309 Thu May 8 16:36:15 2014 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon May 12 11:53:01 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.309 2014/05/08 20:36:15 jakllsch Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.310 2014/05/12 15:53:01 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.309 2014/05/08 20:36:15 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.310 2014/05/12 15:53:01 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -527,11 +527,22 @@ rf_buildroothack(RF_ConfigSet_t *config_ /* we found something bootable... */ + /* + * XXX: The following code assumes that the root raid + * is the first ('a') partition. This is about the best + * we can do with a BSD disklabel, but we might be able + * to do better with a GPT label, by setting a specified + * attribute to indicate the root partition. We can then + * stash the partition number in the r->root_partition + * high bits (the bottom 2 bits are already used). For + * now we just set booted_partition to 0 when we override + * root. + */ if (num_root == 1) { device_t candidate_root; if (rsc->sc_dkdev.dk_nwedges != 0) { - /* XXX: How do we find the real root partition? */ char cname[sizeof(cset->ac->devname)]; + /* XXX: assume 'a' */ snprintf(cname, sizeof(cname), "%s%c", device_xname(rsc->sc_dev), 'a'); candidate_root = dkwedge_find_by_wname(cname); @@ -539,8 +550,10 @@ rf_buildroothack(RF_ConfigSet_t *config_ candidate_root = rsc->sc_dev; if (booted_device == NULL || rsc->sc_r.root_partition == 1 || - rf_containsboot(&rsc->sc_r, booted_device)) + rf_containsboot(&rsc->sc_r, booted_device)) { booted_device = candidate_root; + booted_partition = 0; /* XXX assume 'a' */ + } } else if (num_root > 1) { /* @@ -571,6 +584,7 @@ rf_buildroothack(RF_ConfigSet_t *config_ if (num_root == 1) { booted_device = rsc->sc_dev; + booted_partition = 0; /* XXX assume 'a' */ } else { /* we can't guess.. require the user to answer... */ boothowto |= RB_ASKNAME;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: jakllsch Date: Thu May 8 20:36:15 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Revert default strategy change from 1.298 (which has since moved). Reverting to "fcfs" nearly doubles the speed of sequential reads from a level-1 RAID (previously using the default of "priocscan"). Needs pullup via patch for netbsd-6. To generate a diff of this commit: cvs rdiff -u -r1.308 -r1.309 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.308 src/sys/dev/raidframe/rf_netbsdkintf.c:1.309 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.308 Thu Apr 3 18:55:26 2014 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Thu May 8 20:36:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.308 2014/04/03 18:55:26 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.309 2014/05/08 20:36:15 jakllsch Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.308 2014/04/03 18:55:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.309 2014/05/08 20:36:15 jakllsch Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -343,7 +343,7 @@ raidcreate(int unit) { return NULL; } sc->sc_unit = unit; - bufq_alloc(&sc->buf_queue, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK); + bufq_alloc(&sc->buf_queue, "fcfs", BUFQ_SORT_RAWBLOCK); return sc; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Thu Apr 3 18:55:26 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Add a "soft" root option, leaving the current default as "force root", so as not to break existing configurations. To generate a diff of this commit: cvs rdiff -u -r1.307 -r1.308 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.307 src/sys/dev/raidframe/rf_netbsdkintf.c:1.308 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.307 Thu Apr 3 11:30:52 2014 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Thu Apr 3 14:55:26 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.307 2014/04/03 15:30:52 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.308 2014/04/03 18:55:26 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.307 2014/04/03 15:30:52 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.308 2014/04/03 18:55:26 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -537,11 +537,10 @@ rf_buildroothack(RF_ConfigSet_t *config_ candidate_root = dkwedge_find_by_wname(cname); } else candidate_root = rsc->sc_dev; -#ifndef RAIDFRAME_FORCE_ROOT - if (booted_device == NULL - || rf_containsboot(&rsc->sc_r, booted_device)) -#endif - booted_device = candidate_root; + if (booted_device == NULL || + rsc->sc_r.root_partition == 1 || + rf_containsboot(&rsc->sc_r, booted_device)) + booted_device = candidate_root; } else if (num_root > 1) { /* @@ -3327,6 +3326,10 @@ void rf_print_component_label(RF_ComponentLabel_t *clabel) { uint64_t numBlocks; + static const char *rp[] = { + "No", "Force", "Soft", "*invalid*" + }; + numBlocks = rf_component_label_numblocks(clabel); @@ -3343,8 +3346,7 @@ rf_print_component_label(RF_ComponentLab printf(" RAID Level: %c blocksize: %d numBlocks: %"PRIu64"\n", (char) clabel->parityConfig, clabel->blockSize, numBlocks); printf(" Autoconfig: %s\n", clabel->autoconfigure ? "Yes" : "No"); - printf(" Contains root partition: %s\n", - clabel->root_partition ? "Yes" : "No"); + printf(" Root partition: %s\n", rp[clabel->root_partition & 3]); printf(" Last configured as: raid%d\n", clabel->last_unit); #if 0 printf(" Config order: %d\n", clabel->config_order); @@ -3790,12 +3792,20 @@ rf_auto_config_set(RF_ConfigSet_t *cset) rf_markalldirty(raidPtr); raidPtr->autoconfigure = 1; /* XXX do this here? */ - if (cset->ac->clabel->root_partition==1) { - /* everything configured just fine. Make a note - that this set is eligible to be root. */ - cset->rootable = 1; + switch (cset->ac->clabel->root_partition) { + case 1: /* Force Root */ + case 2: /* Soft Root: root when boot partition part of raid */ + /* + * everything configured just fine. Make a note + * that this set is eligible to be root, + * or forced to be root + */ + cset->rootable = cset->ac->clabel->root_partition; /* XXX do this here? */ - raidPtr->root_partition = 1; + raidPtr->root_partition = cset->rootable; + break; + default: + break; } } else { raidput(sc);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Thu Apr 3 15:30:52 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Fix bugs in raidframe + wedge and root interaction: 1. Don't call cpu_rootconf() just to setup booted_device. Calling cpu_rootconf() multiple times can have nasty side effects (aside from printing root device twice). Instead for those who have it, call cpu_bootconf() which is intended just for that. 2. If the raid component devices are wedges, then matching the booted_device against the wedges will never work; match instead on the wedges parent. XXX: perhaps should keep looking if the parent is a wedge too? To generate a diff of this commit: cvs rdiff -u -r1.306 -r1.307 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.306 src/sys/dev/raidframe/rf_netbsdkintf.c:1.307 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.306 Tue Apr 1 22:17:01 2014 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Thu Apr 3 11:30:52 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.306 2014/04/02 02:17:01 christos Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.307 2014/04/03 15:30:52 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.306 2014/04/02 02:17:01 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.307 2014/04/03 15:30:52 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -431,6 +431,16 @@ rf_autoconfig(device_t self) /* XXX This code can only be run once. */ raidautoconfigdone = true; +#ifdef __HAVE_CPU_BOOTCONF + /* + * 0. find the boot device if needed first so we can use it later + * this needs to be done before we autoconfigure any raid sets, + * because if we use wedges we are not going to be able to open + * the boot device later + */ + if (booted_device == NULL) + cpu_bootconf(); +#endif /* 1. locate all RAID components on the system */ aprint_debug("Searching for RAID components...\n"); ac_list = rf_find_raid_components(); @@ -448,13 +458,19 @@ rf_autoconfig(device_t self) } static int -rf_containsboot(RF_Raid_t *r, device_t dv) { - const char *bootname = device_xname(dv); +rf_containsboot(RF_Raid_t *r, device_t bdv) { + const char *bootname = device_xname(bdv); size_t len = strlen(bootname); for (int col = 0; col < r->numCol; col++) { - char *devname = r->Disks[col].devname; + const char *devname = r->Disks[col].devname; devname += sizeof("/dev/") - 1; + if (strncmp(devname, "dk", 2) == 0) { + const char *parent = + dkwedge_get_parent_name(r->Disks[col].dev); + if (parent != NULL) +devname = parent; + } if (strncmp(devname, bootname, len) == 0) { struct raid_softc *sc = r->softc; aprint_debug("raid%d includes boot device %s\n", @@ -522,8 +538,6 @@ rf_buildroothack(RF_ConfigSet_t *config_ } else candidate_root = rsc->sc_dev; #ifndef RAIDFRAME_FORCE_ROOT - if (booted_device == NULL) - cpu_rootconf(); if (booted_device == NULL || rf_containsboot(&rsc->sc_r, booted_device)) #endif @@ -536,9 +550,6 @@ rf_buildroothack(RF_ConfigSet_t *config_ * booted_device and will ask the user if nothing was * hardwired in the kernel config file */ - - if (booted_device == NULL) - cpu_rootconf(); if (booted_device == NULL) return;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Wed Apr 2 02:17:01 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: If we are autoconfiguring root, then only change the booted_device if we booted from one of the components of the root raid set. This allows us to boot from other media, without forcing the found raid to always be root. Allow the old behavior with RAIDFRAME_FORCE_ROOT. XXX: cpu_rootconf() is called twice now, which prints the booted device message twice. Perhaps we can remember that cpu_rootconf has been called and avoid calling it twice to avoid that. To generate a diff of this commit: cvs rdiff -u -r1.305 -r1.306 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.305 src/sys/dev/raidframe/rf_netbsdkintf.c:1.306 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.305 Sun Mar 16 01:20:29 2014 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Apr 1 22:17:01 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.305 2014/03/16 05:20:29 dholland Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.306 2014/04/02 02:17:01 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.305 2014/03/16 05:20:29 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.306 2014/04/02 02:17:01 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -447,14 +447,30 @@ rf_autoconfig(device_t self) return 1; } +static int +rf_containsboot(RF_Raid_t *r, device_t dv) { + const char *bootname = device_xname(dv); + size_t len = strlen(bootname); + + for (int col = 0; col < r->numCol; col++) { + char *devname = r->Disks[col].devname; + devname += sizeof("/dev/") - 1; + if (strncmp(devname, bootname, len) == 0) { + struct raid_softc *sc = r->softc; + aprint_debug("raid%d includes boot device %s\n", + sc->sc_unit, devname); + return 1; + } + } + return 0; +} + void rf_buildroothack(RF_ConfigSet_t *config_sets) { RF_ConfigSet_t *cset; RF_ConfigSet_t *next_cset; - int col; int num_root; - char *devname; struct raid_softc *sc, *rsc; sc = rsc = NULL; @@ -496,14 +512,22 @@ rf_buildroothack(RF_ConfigSet_t *config_ /* we found something bootable... */ if (num_root == 1) { + device_t candidate_root; if (rsc->sc_dkdev.dk_nwedges != 0) { /* XXX: How do we find the real root partition? */ char cname[sizeof(cset->ac->devname)]; snprintf(cname, sizeof(cname), "%s%c", device_xname(rsc->sc_dev), 'a'); - booted_device = dkwedge_find_by_wname(cname); + candidate_root = dkwedge_find_by_wname(cname); } else - booted_device = rsc->sc_dev; + candidate_root = rsc->sc_dev; +#ifndef RAIDFRAME_FORCE_ROOT + if (booted_device == NULL) + cpu_rootconf(); + if (booted_device == NULL + || rf_containsboot(&rsc->sc_r, booted_device)) +#endif + booted_device = candidate_root; } else if (num_root > 1) { /* @@ -528,14 +552,7 @@ rf_buildroothack(RF_ConfigSet_t *config_ if (r->root_partition == 0) continue; - for (col = 0; col < r->numCol; col++) { -devname = r->Disks[col].devname; -devname += sizeof("/dev/") - 1; -if (strncmp(devname, device_xname(booted_device), - strlen(device_xname(booted_device))) != 0) - continue; -aprint_debug("raid%d includes boot device %s\n", - sc->sc_unit, devname); + if (rf_containsboot(r, booted_device)) { num_root++; rsc = sc; }
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Sun Mar 23 09:30:59 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_decluster.c rf_declusterPQ.c rf_evenodd.c rf_evenodd_dagfuncs.c rf_parityloggingdags.c Log Message: fix unused To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/raidframe/rf_decluster.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/raidframe/rf_declusterPQ.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_evenodd.c \ src/sys/dev/raidframe/rf_parityloggingdags.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_evenodd_dagfuncs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_decluster.c diff -u src/sys/dev/raidframe/rf_decluster.c:1.23 src/sys/dev/raidframe/rf_decluster.c:1.24 --- src/sys/dev/raidframe/rf_decluster.c:1.23 Wed Aug 31 14:31:02 2011 +++ src/sys/dev/raidframe/rf_decluster.c Sun Mar 23 05:30:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_decluster.c,v 1.23 2011/08/31 18:31:02 plunky Exp $ */ +/* $NetBSD: rf_decluster.c,v 1.24 2014/03/23 09:30:59 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -48,7 +48,7 @@ **/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.23 2011/08/31 18:31:02 plunky Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.24 2014/03/23 09:30:59 christos Exp $"); #include @@ -382,7 +382,7 @@ rf_MapParityDeclustered(RF_Raid_t *raidP RF_DeclusteredConfigInfo_t *info = (RF_DeclusteredConfigInfo_t *) layoutPtr->layoutSpecificInfo; RF_StripeNum_t SUID = raidSector / layoutPtr->sectorsPerStripeUnit; RF_StripeNum_t FullTableID, FullTableOffset, TableID, TableOffset; - RF_StripeNum_t BlockID, BlockOffset, RepIndex; + RF_StripeNum_t BlockID, RepIndex; RF_StripeCount_t sus_per_fulltable = info->SUsPerFullTable; RF_StripeCount_t fulltable_depth = info->FullTableDepthInPUs * layoutPtr->SUsPerPU; RF_StripeNum_t base_suid = 0, outSU, SpareRegion = 0, SpareSpace = 0; @@ -404,8 +404,6 @@ rf_MapParityDeclustered(RF_Raid_t *raidP /* BlockID = (TableOffset / info->PUsPerBlock) % * info->BlocksPerTable; */ BlockID = TableOffset / info->PUsPerBlock; - /* BlockOffset = TableOffset % info->PUsPerBlock; */ - BlockOffset = TableOffset - BlockID * info->PUsPerBlock; BlockID %= info->BlocksPerTable; /* the parity block is in the position indicated by RepIndex */ @@ -445,12 +443,10 @@ rf_IdentifyStripeDeclustered(RF_Raid_t * RF_StripeCount_t fulltable_depth = info->FullTableDepthInPUs * layoutPtr->SUsPerPU; RF_StripeNum_t base_suid = 0; RF_StripeNum_t SUID = rf_RaidAddressToStripeUnitID(layoutPtr, addr); - RF_StripeNum_t stripeID, FullTableID; + RF_StripeNum_t stripeID; int tableOffset; rf_decluster_adjust_params(layoutPtr, &SUID, &sus_per_fulltable, &fulltable_depth, &base_suid); - FullTableID = SUID / sus_per_fulltable; /* fulltable ID within array - * (across rows) */ stripeID = rf_StripeUnitIDToStripeID(layoutPtr, SUID); /* find stripe offset * into array */ tableOffset = (stripeID % info->BlocksPerTable); /* find offset into Index: src/sys/dev/raidframe/rf_declusterPQ.c diff -u src/sys/dev/raidframe/rf_declusterPQ.c:1.15 src/sys/dev/raidframe/rf_declusterPQ.c:1.16 --- src/sys/dev/raidframe/rf_declusterPQ.c:1.15 Wed Nov 15 20:33:23 2006 +++ src/sys/dev/raidframe/rf_declusterPQ.c Sun Mar 23 05:30:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_declusterPQ.c,v 1.15 2006/11/16 01:33:23 christos Exp $ */ +/* $NetBSD: rf_declusterPQ.c,v 1.16 2014/03/23 09:30:59 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -35,7 +35,7 @@ *--*/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.15 2006/11/16 01:33:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_declusterPQ.c,v 1.16 2014/03/23 09:30:59 christos Exp $"); #include @@ -56,7 +56,7 @@ rf_ConfigureDeclusteredPQ(RF_ShutdownLis RF_Config_t *cfgPtr) { RF_RaidLayout_t *layoutPtr = &(raidPtr->Layout); - int b, v, k, r, lambda; /* block design params */ + int b, v, k, r; /* block design params */ int i, j, l; int*first_avail_slot; int complete_FT_count, SUID; @@ -78,7 +78,6 @@ rf_ConfigureDeclusteredPQ(RF_ShutdownLis cfgBuf += sizeof(int); r = *((int *) cfgBuf); cfgBuf += sizeof(int); - lambda = *((int *) cfgBuf); cfgBuf += sizeof(int); raidPtr->noRotate = *((int *) cfgBuf); cfgBuf += sizeof(int); @@ -350,7 +349,7 @@ rf_MapParityDeclusteredPQ(RF_Raid_t *rai RF_DeclusteredConfigInfo_t *info = (RF_DeclusteredConfigInfo_t *) layoutPtr->layoutSpecificInfo; RF_StripeNum_t SUID = raidSector / layoutPtr->sectorsPerStripeUnit; RF_StripeNum_t FullTableID, FullTableOffset, TableID, TableOffset; - RF_StripeNum
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: christos Date: Sun Mar 23 03:42:39 UTC 2014 Modified Files: src/sys/dev/raidframe: rf_dagdegwr.c Log Message: remove unused To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/raidframe/rf_dagdegwr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_dagdegwr.c diff -u src/sys/dev/raidframe/rf_dagdegwr.c:1.32 src/sys/dev/raidframe/rf_dagdegwr.c:1.33 --- src/sys/dev/raidframe/rf_dagdegwr.c:1.32 Sun Sep 15 08:20:28 2013 +++ src/sys/dev/raidframe/rf_dagdegwr.c Sat Mar 22 23:42:39 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagdegwr.c,v 1.32 2013/09/15 12:20:28 martin Exp $ */ +/* $NetBSD: rf_dagdegwr.c,v 1.33 2014/03/23 03:42:39 christos Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.32 2013/09/15 12:20:28 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagdegwr.c,v 1.33 2014/03/23 03:42:39 christos Exp $"); #include @@ -582,7 +582,7 @@ rf_WriteGenerateFailedAccessASMs( int numDataCol = layoutPtr->numDataCol; int state; unsigned napdas; - RF_SectorNum_t fone_start, fone_end, ftwo_start = 0, ftwo_end; + RF_SectorNum_t fone_start, ftwo_start = 0; RF_PhysDiskAddr_t *fone = asmap->failedPDAs[0], *ftwo = asmap->failedPDAs[1]; RF_PhysDiskAddr_t *pda_p; RF_RaidAddr_t sosAddr; @@ -592,7 +592,6 @@ rf_WriteGenerateFailedAccessASMs( * possibly two, depending whether they overlap. */ fone_start = rf_StripeUnitOffset(layoutPtr, fone->startSector); - fone_end = fone_start + fone->numSector; if (asmap->numDataFailed == 1) { PDAPerDisk = 1; @@ -608,7 +607,6 @@ rf_WriteGenerateFailedAccessASMs( pda_p->type = RF_PDA_TYPE_Q; } else { ftwo_start = rf_StripeUnitOffset(layoutPtr, ftwo->startSector); - ftwo_end = ftwo_start + ftwo->numSector; if (fone->numSector + ftwo->numSector > secPerSU) { PDAPerDisk = 1; state = 2;
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: riz Date: Fri Nov 22 18:56:27 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_parityloggingdags.c Log Message: Remove RAID_DIAGNOSTIC around a variable and mark __unused instead. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/raidframe/rf_parityloggingdags.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_parityloggingdags.c diff -u src/sys/dev/raidframe/rf_parityloggingdags.c:1.19 src/sys/dev/raidframe/rf_parityloggingdags.c:1.20 --- src/sys/dev/raidframe/rf_parityloggingdags.c:1.19 Tue Nov 18 14:29:55 2008 +++ src/sys/dev/raidframe/rf_parityloggingdags.c Fri Nov 22 18:56:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityloggingdags.c,v 1.19 2008/11/18 14:29:55 ad Exp $ */ +/* $NetBSD: rf_parityloggingdags.c,v 1.20 2013/11/22 18:56:27 riz Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_parityloggingdags.c,v 1.19 2008/11/18 14:29:55 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_parityloggingdags.c,v 1.20 2013/11/22 18:56:27 riz Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -342,9 +342,7 @@ rf_CommonCreateParityLoggingSmallWriteDA int (*qfunc) (RF_DagNode_t * node); const char *name, *qname; RF_StripeNum_t parityStripeID = rf_RaidAddressToParityStripeID(&(raidPtr->Layout), asmap->raidAddress, &which_ru); -#ifdef RAID_DIAGNOSTIC - longnfaults = qfuncs ? 2 : 1; -#endif /* RAID_DIAGNOSTIC */ + longnfaults __unused = qfuncs ? 2 : 1; if (rf_dagDebug) printf("[Creating parity-logging small-write DAG]\n");
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: riz Date: Fri Nov 22 18:55:42 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_evenodd_dagfuncs.c Log Message: Move two RF_ASSERT()s into the protection of RAID_DIAGNOSTIC to avoid a case where we get undeclared variables. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_evenodd_dagfuncs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_evenodd_dagfuncs.c diff -u src/sys/dev/raidframe/rf_evenodd_dagfuncs.c:1.20 src/sys/dev/raidframe/rf_evenodd_dagfuncs.c:1.21 --- src/sys/dev/raidframe/rf_evenodd_dagfuncs.c:1.20 Sat Mar 14 15:36:20 2009 +++ src/sys/dev/raidframe/rf_evenodd_dagfuncs.c Fri Nov 22 18:55:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_evenodd_dagfuncs.c,v 1.20 2009/03/14 15:36:20 dsl Exp $ */ +/* $NetBSD: rf_evenodd_dagfuncs.c,v 1.21 2013/11/22 18:55:42 riz Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_evenodd_dagfuncs.c,v 1.20 2009/03/14 15:36:20 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_evenodd_dagfuncs.c,v 1.21 2013/11/22 18:55:42 riz Exp $"); #include "rf_archs.h" @@ -114,10 +114,10 @@ rf_RegularONEFunc(RF_DagNode_t *node) RF_PhysDiskAddr_t *EPDA = (RF_PhysDiskAddr_t *) node->params[EpdaIndex].p; int ESUOffset = rf_StripeUnitOffset(layoutPtr, EPDA->startSector); -#endif /* RAID_DIAGNOSTIC */ RF_ASSERT(EPDA->type == RF_PDA_TYPE_Q); RF_ASSERT(ESUOffset == 0); +#endif /* RAID_DIAGNOSTIC */ RF_ETIMER_START(timer);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: martin Date: Sun Sep 15 12:48:58 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_reconutil.c Log Message: Mark a variable as potentially unused To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_reconutil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_reconutil.c diff -u src/sys/dev/raidframe/rf_reconutil.c:1.34 src/sys/dev/raidframe/rf_reconutil.c:1.35 --- src/sys/dev/raidframe/rf_reconutil.c:1.34 Wed May 11 18:13:12 2011 +++ src/sys/dev/raidframe/rf_reconutil.c Sun Sep 15 12:48:58 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconutil.c,v 1.34 2011/05/11 18:13:12 mrg Exp $ */ +/* $NetBSD: rf_reconutil.c,v 1.35 2013/09/15 12:48:58 martin Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -31,7 +31,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.34 2011/05/11 18:13:12 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconutil.c,v 1.35 2013/09/15 12:48:58 martin Exp $"); #include @@ -248,7 +248,7 @@ void rf_FreeReconBuffer(RF_ReconBuffer_t *rbuf) { RF_Raid_t *raidPtr = rbuf->raidPtr; - u_int recon_buffer_size; + u_int recon_buffer_size __unused; recon_buffer_size = rf_RaidAddressToByte(raidPtr, raidPtr->Layout.SUsPerRU * raidPtr->Layout.sectorsPerStripeUnit);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: martin Date: Sun Sep 15 12:47:26 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_raid1.c Log Message: Mark variables as potentially unused To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_raid1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_raid1.c diff -u src/sys/dev/raidframe/rf_raid1.c:1.34 src/sys/dev/raidframe/rf_raid1.c:1.35 --- src/sys/dev/raidframe/rf_raid1.c:1.34 Mon May 2 07:29:18 2011 +++ src/sys/dev/raidframe/rf_raid1.c Sun Sep 15 12:47:26 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid1.c,v 1.34 2011/05/02 07:29:18 mrg Exp $ */ +/* $NetBSD: rf_raid1.c,v 1.35 2013/09/15 12:47:26 martin Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.34 2011/05/02 07:29:18 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.35 2013/09/15 12:47:26 martin Exp $"); #include "rf_raid.h" #include "rf_raid1.h" @@ -171,11 +171,11 @@ void rf_RAID1DagSelect(RF_Raid_t *raidPtr, RF_IoType_t type, RF_AccessStripeMap_t *asmap, RF_VoidFuncPtr *createFunc) { - RF_RowCol_t fcol, oc; + RF_RowCol_t fcol, oc __unused; RF_PhysDiskAddr_t *failedPDA; int prior_recon; RF_RowStatus_t rstat; - RF_SectorNum_t oo; + RF_SectorNum_t oo __unused; RF_ASSERT(RF_IO_IS_R_OR_W(type));
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: martin Date: Sun Sep 15 12:45:11 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_engine.c Log Message: ifdef variables like their use To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/raidframe/rf_engine.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_engine.c diff -u src/sys/dev/raidframe/rf_engine.c:1.48 src/sys/dev/raidframe/rf_engine.c:1.49 --- src/sys/dev/raidframe/rf_engine.c:1.48 Sat Apr 27 21:18:42 2013 +++ src/sys/dev/raidframe/rf_engine.c Sun Sep 15 12:45:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_engine.c,v 1.48 2013/04/27 21:18:42 christos Exp $ */ +/* $NetBSD: rf_engine.c,v 1.49 2013/09/15 12:45:11 martin Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -55,7 +55,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.48 2013/04/27 21:18:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.49 2013/09/15 12:45:11 martin Exp $"); #include @@ -631,9 +631,11 @@ PropagateResults(RF_DagNode_t *node, int static void ProcessNode(RF_DagNode_t *node, int context) { +#if RF_DEBUG_ENGINE RF_Raid_t *raidPtr; raidPtr = node->dagHdr->raidPtr; +#endif switch (node->status) { case rf_good:
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: martin Date: Sun Sep 15 12:44:03 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_disks.c Log Message: Avoid unused variable warnings To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/raidframe/rf_disks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_disks.c diff -u src/sys/dev/raidframe/rf_disks.c:1.83 src/sys/dev/raidframe/rf_disks.c:1.84 --- src/sys/dev/raidframe/rf_disks.c:1.83 Thu Jul 19 22:47:52 2012 +++ src/sys/dev/raidframe/rf_disks.c Sun Sep 15 12:44:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.83 2012/07/19 22:47:52 pooka Exp $ */ +/* $NetBSD: rf_disks.c,v 1.84 2013/09/15 12:44:03 martin Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -60,7 +60,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.83 2012/07/19 22:47:52 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.84 2013/09/15 12:44:03 martin Exp $"); #include @@ -1090,18 +1090,19 @@ fail: int rf_remove_hot_spare(RF_Raid_t *raidPtr, RF_SingleComponent_t *sparePtr) { +#if 0 int spare_number; - +#endif if (raidPtr->numSpare==0) { printf("No spares to remove!\n"); return(EINVAL); } - spare_number = sparePtr->column; - return(EINVAL); /* XXX not implemented yet */ #if 0 + spare_number = sparePtr->column; + if (spare_number < 0 || spare_number > raidPtr->numSpare) { return(EINVAL); } @@ -1123,14 +1124,18 @@ rf_remove_hot_spare(RF_Raid_t *raidPtr, int rf_delete_component(RF_Raid_t *raidPtr, RF_SingleComponent_t *component) { +#if 0 RF_RaidDisk_t *disks; +#endif if ((component->column < 0) || (component->column >= raidPtr->numCol)) { return(EINVAL); } +#if 0 disks = &raidPtr->Disks[component->column]; +#endif /* 1. This component must be marked as 'failed' */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: martin Date: Sun Sep 15 12:41:17 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_dagffwr.c Log Message: Move variables into the same ifdef as their use To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/raidframe/rf_dagffwr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_dagffwr.c diff -u src/sys/dev/raidframe/rf_dagffwr.c:1.33 src/sys/dev/raidframe/rf_dagffwr.c:1.34 --- src/sys/dev/raidframe/rf_dagffwr.c:1.33 Thu Nov 16 01:33:23 2006 +++ src/sys/dev/raidframe/rf_dagffwr.c Sun Sep 15 12:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagffwr.c,v 1.33 2006/11/16 01:33:23 christos Exp $ */ +/* $NetBSD: rf_dagffwr.c,v 1.34 2013/09/15 12:41:17 martin Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.33 2006/11/16 01:33:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagffwr.c,v 1.34 2013/09/15 12:41:17 martin Exp $"); #include @@ -167,7 +167,10 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t * int allowBufferRecycle) { RF_DagNode_t *wndNodes, *rodNodes, *xorNode, *wnpNode, *tmpNode; - RF_DagNode_t *wnqNode, *blockNode, *commitNode, *termNode; + RF_DagNode_t *blockNode, *commitNode, *termNode; +#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) + RF_DagNode_t *wnqNode; +#endif int nWndNodes, nRodNodes, i, nodeNum, asmNum; RF_AccessStripeMapHeader_t *new_asm_h[2]; RF_StripeNum_t parityStripeID; @@ -226,9 +229,7 @@ rf_CommonCreateLargeWriteDAG(RF_Raid_t * if (nfaults == 2) { wnqNode = rf_AllocDAGNode(); } else { -#endif wnqNode = NULL; -#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) } #endif rf_MapUnaccessedPortionOfStripe(raidPtr, layoutPtr, asmap, dag_h, @@ -524,23 +525,24 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t * const RF_RedFuncs_t *pfuncs, const RF_RedFuncs_t *qfuncs) { - RF_DagNode_t *readDataNodes, *readParityNodes, *readQNodes, *termNode; + RF_DagNode_t *readDataNodes, *readParityNodes, *termNode; RF_DagNode_t *tmpNode, *tmpreadDataNode, *tmpreadParityNode; - RF_DagNode_t *xorNodes, *qNodes, *blockNode, *commitNode; - RF_DagNode_t *writeDataNodes, *writeParityNodes, *writeQNodes; - RF_DagNode_t *tmpxorNode, *tmpqNode, *tmpwriteDataNode, *tmpreadQNode; + RF_DagNode_t *xorNodes, *blockNode, *commitNode; + RF_DagNode_t *writeDataNodes, *writeParityNodes; + RF_DagNode_t *tmpxorNode, *tmpwriteDataNode; RF_DagNode_t *tmpwriteParityNode; #if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) - RF_DagNode_t *tmpwriteQNode; + RF_DagNode_t *tmpwriteQNode, *tmpreadQNode, *tmpqNode, *readQNodes, + *writeQNodes, *qNodes; #endif - int i, j, nNodes, totalNumNodes; + int i, j, nNodes; RF_ReconUnitNum_t which_ru; int (*func) (RF_DagNode_t *), (*undoFunc) (RF_DagNode_t *); - int (*qfunc) (RF_DagNode_t *); + int (*qfunc) (RF_DagNode_t *) __unused; int numDataNodes, numParityNodes; RF_StripeNum_t parityStripeID; RF_PhysDiskAddr_t *pda; - const char *name, *qname; + const char *name, *qname __unused; longnfaults; nfaults = qfuncs ? 2 : 1; @@ -579,9 +581,11 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t * * redundancy computation node for each parity node (nfaults * * nparity) a read and write for each parity unit a block and * commit node (2) a terminate node if atomic RMW an unlock - * node for each data unit, redundancy unit */ - totalNumNodes = (2 * numDataNodes) + (nfaults * numParityNodes) - + (nfaults * 2 * numParityNodes) + 3; + * node for each data unit, redundancy unit + * totalNumNodes = (2 * numDataNodes) + (nfaults * numParityNodes) + * + (nfaults * 2 * numParityNodes) + 3; + */ + /* * Step 2. create the nodes */ @@ -656,9 +660,7 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t * } qNodes = dag_h->nodes; } else { -#endif readQNodes = writeQNodes = qNodes = NULL; -#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) } #endif @@ -818,8 +820,10 @@ rf_CommonCreateSmallWriteDAG(RF_Raid_t * tmpreadDataNode = readDataNodes; tmpreadParityNode = readParityNodes; tmpwriteDataNode = writeDataNodes; +#if (RF_INCLUDE_DECL_PQ > 0) || (RF_INCLUDE_RAID6 > 0) tmpqNode = qNodes; tmpreadQNode = readQNodes; +#endif for (i = 0; i < numParityNodes; i++) { /* note: no wakeup func for xor */ rf_InitNode(tmpxorNode, rf_wait, RF_FALSE, func,
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: martin Date: Sun Sep 15 12:23:06 UTC 2013 Modified Files: src/sys/dev/raidframe: rf_dagffrd.c Log Message: Remove unused variables To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/raidframe/rf_dagffrd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/raidframe/rf_dagffrd.c diff -u src/sys/dev/raidframe/rf_dagffrd.c:1.18 src/sys/dev/raidframe/rf_dagffrd.c:1.19 --- src/sys/dev/raidframe/rf_dagffrd.c:1.18 Thu Nov 16 01:33:23 2006 +++ src/sys/dev/raidframe/rf_dagffrd.c Sun Sep 15 12:23:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagffrd.c,v 1.18 2006/11/16 01:33:23 christos Exp $ */ +/* $NetBSD: rf_dagffrd.c,v 1.19 2013/09/15 12:23:06 martin Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.18 2006/11/16 01:33:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagffrd.c,v 1.19 2013/09/15 12:23:06 martin Exp $"); #include @@ -133,7 +133,7 @@ rf_CreateNonredundantDAG(RF_Raid_t *raid RF_DagNode_t *tmpNode, *tmpdiskNode; RF_PhysDiskAddr_t *pda = asmap->physInfo; int (*doFunc) (RF_DagNode_t *), (*undoFunc) (RF_DagNode_t *); - int i, n, totalNumNodes; + int i, n; const char *name; n = asmap->numStripeUnitsAccessed; @@ -179,7 +179,6 @@ rf_CreateNonredundantDAG(RF_Raid_t *raid * 1 terminator node */ RF_ASSERT(n > 0); - totalNumNodes = n + 3; for (i = 0; i < n; i++) { tmpNode = rf_AllocDAGNode(); @@ -326,7 +325,7 @@ CreateMirrorReadDAG(RF_Raid_t *raidPtr, RF_DagNode_t *tmpNode, *tmpreadNode; RF_PhysDiskAddr_t *data_pda = asmap->physInfo; RF_PhysDiskAddr_t *parity_pda = asmap->parityInfo; - int i, n, totalNumNodes; + int i, n; n = asmap->numStripeUnitsAccessed; dag_h->creator = "RaidOneReadDAG"; @@ -351,7 +350,6 @@ CreateMirrorReadDAG(RF_Raid_t *raidPtr, * 1 terminator node */ RF_ASSERT(n > 0); - totalNumNodes = n + 3; for (i = 0; i < n; i++) { tmpNode = rf_AllocDAGNode();