We no longer need the deprecated copyback functionality now that

incorporating a used spare is automatic.

Copyback has always been an issue, as to do a copyback all IO to
the array had to be suspended, and so was very, very unlikely to
have been used in anything resembling a production system.
This commit is contained in:
oster 2023-09-25 21:59:38 +00:00
parent 893b209b11
commit 808873b5c3
12 changed files with 32 additions and 612 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: raidctl.8,v 1.81 2023/09/21 01:40:44 oster Exp $
.\" $NetBSD: raidctl.8,v 1.82 2023/09/25 21:59:38 oster Exp $
.\"
.\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -53,7 +53,7 @@
.\" any improvements or extensions that they make and grant Carnegie the
.\" rights to redistribute these changes.
.\"
.Dd September 20, 2023
.Dd September 25, 2023
.Dt RAIDCTL 8
.Os
.Sh NAME
@ -73,9 +73,6 @@
.Fl a Ar component Ar dev
.Nm
.Op Fl v
.Fl B Ar dev
.Nm
.Op Fl v
.Fl C Ar config_file Ar dev
.Nm
.Op Fl v
@ -223,11 +220,6 @@ component within a particular RAID set) are automatically added to the
hot spare after it has been used and are not required for
.Ar component
before it is used.
.It Fl B Ar dev
Initiate a copyback of reconstructed data from a spare disk to
its original disk.
This is performed after a component has failed,
and the failed drive has been reconstructed onto a spare drive.
.It Fl C Ar config_file Ar dev
As for
.Fl c ,
@ -351,8 +343,7 @@ Remove the specified
from the RAID. The component must be in the failed, spare, or spared state
in order to be removed.
.It Fl S Ar dev
Check the status of parity re-writing, component reconstruction, and
component copyback.
Check the status of parity re-writing and component reconstruction.
The output indicates the amount of progress
achieved in each of these areas.
.It Fl s Ar dev
@ -374,9 +365,8 @@ Unconfigure the RAIDframe device.
This does not remove any component labels or change any configuration
settings (e.g. auto-configuration settings) for the RAID set.
.It Fl v
Be more verbose.
For operations such as reconstructions, parity
re-writing, and copybacks, provide a progress indicator.
Be more verbose, and provide a progress indicator for operations such
as reconstructions and parity re-writing.
.El
.Pp
The device used by
@ -965,7 +955,6 @@ Component label for /dev/sd3e:
Parity status: clean
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.
.Ed
.Pp
This indicates that all is well with the RAID set.
@ -1051,7 +1040,6 @@ Spares:
Parity status: clean
Reconstruction is 10% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.
.Ed
.Pp
This indicates that a reconstruction is in progress.
@ -1073,7 +1061,6 @@ No spares.
Parity status: clean
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.
.Ed
.Pp
as

View File

@ -1,4 +1,4 @@
/* $NetBSD: raidctl.c,v 1.81 2023/09/21 01:48:41 oster Exp $ */
/* $NetBSD: raidctl.c,v 1.82 2023/09/25 21:59:38 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: raidctl.c,v 1.81 2023/09/21 01:48:41 oster Exp $");
__RCSID("$NetBSD: raidctl.c,v 1.82 2023/09/25 21:59:38 oster Exp $");
#endif
@ -191,10 +191,6 @@ main(int argc,char *argv[])
strlcpy(autoconf, optarg, sizeof(autoconf));
num_options++;
break;
case 'B':
action = RAIDFRAME_COPYBACK;
num_options++;
break;
case 'c':
action = RAIDFRAME_CONFIGURE;
strlcpy(config_filename, optarg,
@ -371,15 +367,6 @@ main(int argc,char *argv[])
case RAIDFRAME_SET_AUTOCONFIG:
set_autoconfig(fd, raidID, autoconf);
break;
case RAIDFRAME_COPYBACK:
printf("Copyback.\n");
do_ioctl(fd, RAIDFRAME_COPYBACK, NULL, "RAIDFRAME_COPYBACK");
if (verbose) {
sleep(3); /* XXX give the copyback a chance to start */
printf("Copyback status:\n");
do_meter(fd,RAIDFRAME_CHECK_COPYBACK_STATUS_EXT);
}
break;
case RAIDFRAME_FAIL_DISK:
rf_fail_disk(fd, component, do_recon);
break;
@ -1059,7 +1046,6 @@ check_status(int fd, int meter)
{
int recon_percent_done = 0;
int parity_percent_done = 0;
int copyback_percent_done = 0;
do_ioctl(fd, RAIDFRAME_CHECK_RECON_STATUS, &recon_percent_done,
"RAIDFRAME_CHECK_RECON_STATUS");
@ -1068,9 +1054,6 @@ check_status(int fd, int meter)
&parity_percent_done,
"RAIDFRAME_CHECK_PARITYREWRITE_STATUS");
printf("Parity Re-write is %d%% complete.\n", parity_percent_done);
do_ioctl(fd, RAIDFRAME_CHECK_COPYBACK_STATUS, &copyback_percent_done,
"RAIDFRAME_CHECK_COPYBACK_STATUS");
printf("Copyback is %d%% complete.\n", copyback_percent_done);
if (meter) {
/* These 3 should be mutually exclusive at this point */
@ -1080,9 +1063,6 @@ check_status(int fd, int meter)
} else if (parity_percent_done < 100) {
printf("Parity Re-write status:\n");
do_meter(fd,RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT);
} else if (copyback_percent_done < 100) {
printf("Copyback status:\n");
do_meter(fd,RAIDFRAME_CHECK_COPYBACK_STATUS_EXT);
}
}
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.raidframe,v 1.10 2018/01/18 00:32:49 mrg Exp $
# $NetBSD: files.raidframe,v 1.11 2023/09/25 21:59:38 oster Exp $
defflag RAID_AUTOCONFIG
defflag RAID_DIAGNOSTIC
@ -10,7 +10,6 @@ file dev/raidframe/rf_alloclist.c raid
file dev/raidframe/rf_aselect.c raid
file dev/raidframe/rf_callback.c raid
file dev/raidframe/rf_chaindecluster.c raid
file dev/raidframe/rf_copyback.c raid
file dev/raidframe/rf_cvscan.c raid
file dev/raidframe/rf_dagdegrd.c raid
file dev/raidframe/rf_dagdegwr.c raid

View File

@ -1,428 +0,0 @@
/* $NetBSD: rf_copyback.c,v 1.55 2021/07/27 03:01:48 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Mark Holland
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/*****************************************************************************
*
* copyback.c -- code to copy reconstructed data back from spare space to
* the replaced disk.
*
* the code operates using callbacks on the I/Os to continue with the
* next unit to be copied back. We do this because a simple loop
* containing blocking I/Os will not work in the simulator.
*
****************************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.55 2021/07/27 03:01:48 oster Exp $");
#include <dev/raidframe/raidframevar.h>
#include <sys/time.h>
#include <sys/buf.h>
#include "rf_raid.h"
#include "rf_mcpair.h"
#include "rf_acctrace.h"
#include "rf_etimer.h"
#include "rf_general.h"
#include "rf_utils.h"
#include "rf_copyback.h"
#include "rf_decluster.h"
#include "rf_driver.h"
#include "rf_shutdown.h"
#include "rf_kintf.h"
#define RF_COPYBACK_DATA 0
#define RF_COPYBACK_PARITY 1
int rf_copyback_in_progress;
static void rf_CopybackReadDoneProc(void *, int);
static void rf_CopybackWriteDoneProc(void *, int);
static void rf_CopybackOne(RF_CopybackDesc_t * desc, int typ,
RF_RaidAddr_t addr, RF_RowCol_t testCol,
RF_SectorNum_t testOffs);
static void rf_CopybackComplete(RF_CopybackDesc_t * desc, int status);
int
rf_ConfigureCopyback(RF_ShutdownList_t **listp)
{
rf_copyback_in_progress = 0;
return (0);
}
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/vnode.h>
#include <sys/namei.h> /* for pathbuf */
#include <miscfs/specfs/specdev.h> /* for v_rdev */
/* do a complete copyback */
void
rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
{
RF_ComponentLabel_t *c_label;
int found, retcode;
RF_CopybackDesc_t *desc;
RF_RowCol_t fcol;
RF_RaidDisk_t *badDisk;
char *databuf;
struct pathbuf *dev_pb;
struct vnode *vp;
int ac;
fcol = 0;
found = 0;
for (fcol = 0; fcol < raidPtr->numCol; fcol++) {
if (raidPtr->Disks[fcol].status == rf_ds_dist_spared
|| raidPtr->Disks[fcol].status == rf_ds_spared) {
found = 1;
break;
}
}
if (!found) {
printf("raid%d: no disks need copyback\n", raidPtr->raidid);
return;
}
badDisk = &raidPtr->Disks[fcol];
/* This device may have been opened successfully the first time. Close
* it before trying to open it again.. */
if (raidPtr->raid_cinfo[fcol].ci_vp != NULL) {
printf("Closed the open device: %s\n",
raidPtr->Disks[fcol].devname);
vp = raidPtr->raid_cinfo[fcol].ci_vp;
ac = raidPtr->Disks[fcol].auto_configured;
rf_close_component(raidPtr, vp, ac);
raidPtr->raid_cinfo[fcol].ci_vp = NULL;
}
/* note that this disk was *not* auto_configured (any longer) */
raidPtr->Disks[fcol].auto_configured = 0;
printf("About to (re-)open the device: %s\n",
raidPtr->Disks[fcol].devname);
dev_pb = pathbuf_create(raidPtr->Disks[fcol].devname);
if (dev_pb == NULL) {
/* shouldn't happen unless maybe the system is OOMing */
printf("raid%d: copyback: pathbuf_create on device: %s failed: %d!\n",
raidPtr->raidid, raidPtr->Disks[fcol].devname,
ENOMEM);
return;
}
retcode = vn_bdev_openpath(dev_pb, &vp, curlwp);
pathbuf_destroy(dev_pb);
if (retcode) {
printf("raid%d: copyback: open device: %s failed: %d!\n",
raidPtr->raidid, raidPtr->Disks[fcol].devname,
retcode);
/* XXX the component isn't responding properly... must be
* still dead :-( */
return;
} else {
/* Ok, so we can at least do a lookup... How about actually
* getting a vp for it? */
retcode = rf_getdisksize(vp, &raidPtr->Disks[fcol]);
if (retcode) {
return;
}
raidPtr->raid_cinfo[fcol].ci_vp = vp;
raidPtr->raid_cinfo[fcol].ci_dev = vp->v_rdev;
raidPtr->Disks[fcol].dev = vp->v_rdev; /* XXX or the above? */
/* we allow the user to specify that only a fraction of the
* disks should be used this is just for debug: it speeds up
* the parity scan */
raidPtr->Disks[fcol].numBlocks =
raidPtr->Disks[fcol].numBlocks *
rf_sizePercentage / 100;
}
if (retcode) {
printf("raid%d: copyback: target disk failed TUR\n",
raidPtr->raidid);
return;
}
/* get a buffer to hold one SU */
databuf = RF_Malloc(rf_RaidAddressToByte(raidPtr,
raidPtr->Layout.sectorsPerStripeUnit));
/* create a descriptor */
desc = RF_Malloc(sizeof(*desc));
desc->raidPtr = raidPtr;
desc->status = 0;
desc->fcol = fcol;
desc->spCol = badDisk->spareCol;
desc->stripeAddr = 0;
desc->sectPerSU = raidPtr->Layout.sectorsPerStripeUnit;
desc->sectPerStripe = raidPtr->Layout.sectorsPerStripeUnit * raidPtr->Layout.numDataCol;
desc->databuf = databuf;
desc->mcpair = rf_AllocMCPair(raidPtr);
/* quiesce the array, since we don't want to code support for user
* accs here */
rf_SuspendNewRequestsAndWait(raidPtr);
/* adjust state of the array and of the disks */
rf_lock_mutex2(raidPtr->mutex);
raidPtr->Disks[desc->fcol].status = rf_ds_optimal;
raidPtr->status = rf_rs_optimal;
rf_copyback_in_progress = 1; /* debug only */
rf_unlock_mutex2(raidPtr->mutex);
RF_GETTIME(desc->starttime);
rf_ContinueCopyback(desc);
/* Data has been restored. Fix up the component label. */
/* Don't actually need the read here.. */
c_label = raidget_component_label(raidPtr, fcol);
raid_init_component_label(raidPtr, c_label);
c_label->row = 0;
c_label->column = fcol;
rf_component_label_set_partitionsize(c_label,
raidPtr->Disks[fcol].partitionSize);
raidflush_component_label(raidPtr, fcol);
/* XXXjld why is this here? */
rf_update_component_labels(raidPtr, RF_NORMAL_COMPONENT_UPDATE);
}
/*
* invoked via callback after a copyback I/O has completed to
* continue on with the next one
*/
void
rf_ContinueCopyback(RF_CopybackDesc_t *desc)
{
RF_SectorNum_t testOffs, stripeAddr;
RF_Raid_t *raidPtr = desc->raidPtr;
RF_RaidAddr_t addr;
RF_RowCol_t testCol;
#if RF_DEBUG_RECON
int old_pctg, new_pctg;
struct timeval t, diff;
#endif
int done;
#if RF_DEBUG_RECON
old_pctg = (-1);
#endif
while (1) {
stripeAddr = desc->stripeAddr;
desc->raidPtr->copyback_stripes_done = stripeAddr
/ desc->sectPerStripe;
#if RF_DEBUG_RECON
if (rf_prReconSched) {
old_pctg = 100 * desc->stripeAddr / raidPtr->totalSectors;
}
#endif
desc->stripeAddr += desc->sectPerStripe;
#if RF_DEBUG_RECON
if (rf_prReconSched) {
new_pctg = 100 * desc->stripeAddr / raidPtr->totalSectors;
if (new_pctg != old_pctg) {
RF_GETTIME(t);
RF_TIMEVAL_DIFF(&desc->starttime, &t, &diff);
printf("%d %d.%06d\n", new_pctg, (int) diff.tv_sec, (int) diff.tv_usec);
}
}
#endif
if (stripeAddr >= raidPtr->totalSectors) {
rf_CopybackComplete(desc, 0);
return;
}
/* walk through the current stripe, su-by-su */
for (done = 0, addr = stripeAddr; addr < stripeAddr + desc->sectPerStripe; addr += desc->sectPerSU) {
/* map the SU, disallowing remap to spare space */
(raidPtr->Layout.map->MapSector) (raidPtr, addr, &testCol, &testOffs, RF_DONT_REMAP);
if (testCol == desc->fcol) {
rf_CopybackOne(desc, RF_COPYBACK_DATA, addr, testCol, testOffs);
done = 1;
break;
}
}
if (!done) {
/* we didn't find the failed disk in the data part.
* check parity. */
/* map the parity for this stripe, disallowing remap
* to spare space */
(raidPtr->Layout.map->MapParity) (raidPtr, stripeAddr, &testCol, &testOffs, RF_DONT_REMAP);
if (testCol == desc->fcol) {
rf_CopybackOne(desc, RF_COPYBACK_PARITY, stripeAddr, testCol, testOffs);
}
}
/* check to see if the last read/write pair failed */
if (desc->status) {
rf_CopybackComplete(desc, 1);
return;
}
/* we didn't find any units to copy back in this stripe.
* Continue with the next one */
}
}
/* copyback one unit */
static void
rf_CopybackOne(RF_CopybackDesc_t *desc, int typ, RF_RaidAddr_t addr,
RF_RowCol_t testCol, RF_SectorNum_t testOffs)
{
RF_SectorCount_t sectPerSU = desc->sectPerSU;
RF_Raid_t *raidPtr = desc->raidPtr;
RF_RowCol_t spCol = desc->spCol;
RF_SectorNum_t spOffs;
/* find the spare spare location for this SU */
if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
if (typ == RF_COPYBACK_DATA)
raidPtr->Layout.map->MapSector(raidPtr, addr, &spCol, &spOffs, RF_REMAP);
else
raidPtr->Layout.map->MapParity(raidPtr, addr, &spCol, &spOffs, RF_REMAP);
} else {
spOffs = testOffs;
}
/* 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);
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);
desc->fcol = testCol;
/* enqueue the read. the write will go out as part of the callback on
* the read. at user-level & in the kernel, wait for the read-write
* pair to complete. in the simulator, just return, since everything
* will happen as callbacks */
RF_LOCK_MCPAIR(desc->mcpair);
desc->mcpair->flag = 0;
RF_UNLOCK_MCPAIR(desc->mcpair);
rf_DiskIOEnqueue(&raidPtr->Queues[spCol], desc->readreq, RF_IO_NORMAL_PRIORITY);
RF_LOCK_MCPAIR(desc->mcpair);
while (!desc->mcpair->flag) {
RF_WAIT_MCPAIR(desc->mcpair);
}
RF_UNLOCK_MCPAIR(desc->mcpair);
rf_FreeDiskQueueData(desc->readreq);
rf_FreeDiskQueueData(desc->writereq);
}
/* called at interrupt context when the read has completed. just send out the write */
static void
rf_CopybackReadDoneProc(void *v, int status)
{
RF_CopybackDesc_t *desc = v;
if (status) { /* invoke the callback with bad status */
printf("raid%d: copyback read failed. Aborting.\n",
desc->raidPtr->raidid);
(desc->writereq->CompleteFunc) (desc, -100);
} else {
rf_DiskIOEnqueue(&(desc->raidPtr->Queues[desc->fcol]), desc->writereq, RF_IO_NORMAL_PRIORITY);
}
}
/* called at interrupt context when the write has completed.
* at user level & in the kernel, wake up the copyback thread.
* in the simulator, invoke the next copyback directly.
* can't free diskqueuedata structs in the kernel b/c we're at interrupt context.
*/
static void
rf_CopybackWriteDoneProc(void *v, int status)
{
RF_CopybackDesc_t *desc = v;
if (status && status != -100) {
printf("raid%d: copyback write failed. Aborting.\n",
desc->raidPtr->raidid);
}
desc->status = status;
rf_MCPairWakeupFunc(desc->mcpair);
}
/* invoked when the copyback has completed */
static void
rf_CopybackComplete(RF_CopybackDesc_t *desc, int status)
{
RF_Raid_t *raidPtr = desc->raidPtr;
struct timeval t, diff;
if (!status) {
rf_lock_mutex2(raidPtr->mutex);
if (raidPtr->Layout.map->flags & RF_DISTRIBUTE_SPARE) {
RF_ASSERT(raidPtr->Layout.map->parityConfig == 'D');
rf_FreeSpareTable(raidPtr);
} else {
raidPtr->Disks[desc->spCol].status = rf_ds_spare;
}
rf_unlock_mutex2(raidPtr->mutex);
RF_GETTIME(t);
RF_TIMEVAL_DIFF(&desc->starttime, &t, &diff);
#if 0
printf("Copyback time was %d.%06d seconds\n",
(int) diff.tv_sec, (int) diff.tv_usec);
#endif
} else
printf("raid%d: Copyback failure. Status: %d\n",
raidPtr->raidid, status);
RF_Free(desc->databuf, rf_RaidAddressToByte(raidPtr, desc->sectPerSU));
rf_FreeMCPair(raidPtr, desc->mcpair);
RF_Free(desc, sizeof(*desc));
rf_copyback_in_progress = 0;
rf_ResumeNewRequests(raidPtr);
}

View File

@ -1,58 +0,0 @@
/* $NetBSD: rf_copyback.h,v 1.6 2005/12/11 12:23:37 christos Exp $ */
/*
* rf_copyback.h
*/
/*
* Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Jim Zelenka
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#ifndef _RF__RF_COPYBACK_H_
#define _RF__RF_COPYBACK_H_
#include <dev/raidframe/raidframevar.h>
typedef struct RF_CopybackDesc_s {
RF_Raid_t *raidPtr;
RF_RowCol_t fcol;
RF_RowCol_t spCol;
int status;
RF_StripeNum_t stripeAddr;
RF_SectorCount_t sectPerSU;
RF_SectorCount_t sectPerStripe;
char *databuf;
RF_DiskQueueData_t *readreq;
RF_DiskQueueData_t *writereq;
struct timeval starttime;
RF_MCPair_t *mcpair;
} RF_CopybackDesc_t;
extern int rf_copyback_in_progress;
int rf_ConfigureCopyback(RF_ShutdownList_t ** listp);
void rf_CopybackReconstructedData(RF_Raid_t * raidPtr);
void rf_ContinueCopyback(RF_CopybackDesc_t * desc);
#endif /* !_RF__RF_COPYBACK_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_decluster.c,v 1.26 2019/02/09 03:34:00 christos Exp $ */
/* $NetBSD: rf_decluster.c,v 1.27 2023/09/25 21:59:38 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -48,7 +48,7 @@
*--------------------------------------------------------------------*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.26 2019/02/09 03:34:00 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.27 2023/09/25 21:59:38 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@ -61,7 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_decluster.c,v 1.26 2019/02/09 03:34:00 christos E
#include "rf_general.h"
#include "rf_kintf.h"
#include "rf_shutdown.h"
#include "rf_copyback.h"
#if (RF_INCLUDE_PARITY_DECLUSTERING > 0) || (RF_INCLUDE_PARITY_DECLUSTERING_PQ > 0)
@ -350,8 +349,7 @@ rf_MapSectorDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector,
/* remap to distributed spare space if indicated */
if (remap) {
RF_ASSERT(raidPtr->Disks[*col].status == rf_ds_reconstructing || raidPtr->Disks[*col].status == rf_ds_dist_spared ||
(rf_copyback_in_progress && raidPtr->Disks[*col].status == rf_ds_optimal));
RF_ASSERT(raidPtr->Disks[*col].status == rf_ds_reconstructing || raidPtr->Disks[*col].status == rf_ds_dist_spared);
rf_remap_to_spare_space(layoutPtr, info, FullTableID, TableID, BlockID, (base_suid) ? 1 : 0, SpareRegion, col, &outSU);
} else {
@ -411,8 +409,7 @@ rf_MapParityDeclustered(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector,
*col = info->LayoutTable[BlockID][RepIndex];
if (remap) {
RF_ASSERT(raidPtr->Disks[*col].status == rf_ds_reconstructing || raidPtr->Disks[*col].status == rf_ds_dist_spared ||
(rf_copyback_in_progress && raidPtr->Disks[*col].status == rf_ds_optimal));
RF_ASSERT(raidPtr->Disks[*col].status == rf_ds_reconstructing || raidPtr->Disks[*col].status == rf_ds_dist_spared);
rf_remap_to_spare_space(layoutPtr, info, FullTableID, TableID, BlockID, (base_suid) ? 1 : 0, SpareRegion, col, &outSU);
} else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_driver.c,v 1.141 2023/09/17 20:07:39 oster Exp $ */
/* $NetBSD: rf_driver.c,v 1.142 2023/09/25 21:59:38 oster Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -66,7 +66,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.141 2023/09/17 20:07:39 oster Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.142 2023/09/25 21:59:38 oster Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_diagnostic.h"
@ -104,7 +104,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.141 2023/09/17 20:07:39 oster Exp $"
#include "rf_engine.h"
#include "rf_mcpair.h"
#include "rf_nwayxor.h"
#include "rf_copyback.h"
#include "rf_driver.h"
#include "rf_options.h"
#include "rf_shutdown.h"
@ -322,7 +321,6 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac)
#endif
DO_INIT_CONFIGURE(rf_ConfigureNWayXor);
DO_INIT_CONFIGURE(rf_ConfigureDAGFuncs);
DO_INIT_CONFIGURE(rf_ConfigureCopyback);
isconfigged = 1;
}
rf_unlock_mutex2(configureMutex);
@ -400,7 +398,6 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, RF_AutoConfig_t *ac)
}
#endif
raidPtr->numNewFailures = 0;
raidPtr->copyback_in_progress = 0;
raidPtr->parity_rewrite_in_progress = 0;
raidPtr->changing_components = 0;
raidPtr->recon_in_progress = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.414 2023/09/17 20:07:39 oster Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.415 2023/09/25 21:59:38 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.414 2023/09/17 20:07:39 oster Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.415 2023/09/25 21:59:38 oster Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_autoconfig.h"
@ -136,7 +136,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.414 2023/09/17 20:07:39 oster E
#include <dev/raidframe/rf_paritymap.h>
#include "rf_raid.h"
#include "rf_copyback.h"
#include "rf_dag.h"
#include "rf_dagflags.h"
#include "rf_desc.h"
@ -296,7 +295,6 @@ static void rf_set_geometry(struct raid_softc *, RF_Raid_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 int rf_rescan(void);
@ -1069,8 +1067,7 @@ raid_detach_unlocked(struct raid_softc *rs)
if (DK_BUSY(dksc, 0) ||
raidPtr->recon_in_progress != 0 ||
raidPtr->parity_rewrite_in_progress != 0 ||
raidPtr->copyback_in_progress != 0)
raidPtr->parity_rewrite_in_progress != 0)
return EBUSY;
if ((rs->sc_flags & RAIDF_INITED) == 0)
@ -1511,8 +1508,7 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
if (DK_BUSY(dksc, pmask) ||
raidPtr->recon_in_progress != 0 ||
raidPtr->parity_rewrite_in_progress != 0 ||
raidPtr->copyback_in_progress != 0)
raidPtr->parity_rewrite_in_progress != 0)
retcode = EBUSY;
else {
/* detach and free on close */
@ -1652,22 +1648,9 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
case RAIDFRAME_FAIL_DISK:
return rf_fail_disk(raidPtr, data);
/* invoke a copyback operation after recon on whatever disk
* needs it, if any */
/* copyback is no longer supported */
case RAIDFRAME_COPYBACK:
if (raidPtr->Layout.map->faultsTolerated == 0) {
/* This makes no sense on a RAID 0!! */
return EINVAL;
}
if (raidPtr->copyback_in_progress == 1) {
/* Copyback is already in progress! */
return EINVAL;
}
return RF_CREATE_THREAD(raidPtr->copyback_thread,
rf_CopybackThread, raidPtr, "raid_copyback");
return EINVAL;
/* return the percentage completion of reconstruction */
case RAIDFRAME_CHECK_RECON_STATUS:
@ -1698,17 +1681,7 @@ raidioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
return 0;
case RAIDFRAME_CHECK_COPYBACK_STATUS:
if (raidPtr->Layout.map->faultsTolerated == 0) {
/* This makes no sense on a RAID 0 */
*(int *) data = 100;
return 0;
}
if (raidPtr->copyback_in_progress == 1) {
*(int *) data = 100 * raidPtr->copyback_stripes_done /
raidPtr->Layout.numStripe;
} else {
*(int *) data = 100;
}
*(int *) data = 100;
return 0;
case RAIDFRAME_CHECK_COPYBACK_STATUS_EXT:
@ -2791,23 +2764,6 @@ rf_RewriteParityThread(RF_Raid_t *raidPtr)
kthread_exit(0); /* does not return */
}
static void
rf_CopybackThread(RF_Raid_t *raidPtr)
{
int s;
raidPtr->copyback_in_progress = 1;
s = splbio();
rf_CopybackReconstructedData(raidPtr);
splx(s);
raidPtr->copyback_in_progress = 0;
/* That's all... */
kthread_exit(0); /* does not return */
}
static void
rf_ReconstructInPlaceThread(struct rf_recon_req_internal *req)
{
@ -3900,16 +3856,9 @@ rf_check_copyback_status_ext(RF_Raid_t *raidPtr, RF_ProgressInfo_t *info)
{
memset(info, 0, sizeof(*info));
if (raidPtr->copyback_in_progress == 1) {
info->total = raidPtr->Layout.numStripe;
info->completed = raidPtr->copyback_stripes_done;
info->remaining = info->total - info->completed;
} else {
info->remaining = 0;
info->completed = 100;
info->total = 100;
}
info->remaining = 0;
info->completed = 100;
info->total = 100;
}
/* Fill in config with the current info */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_paritymap.c,v 1.10 2020/09/27 21:39:08 christos Exp $ */
/* $NetBSD: rf_paritymap.c,v 1.11 2023/09/25 21:59:38 oster Exp $ */
/*-
* Copyright (c) 2009 Jed Davis.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.10 2020/09/27 21:39:08 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.11 2023/09/25 21:59:38 oster Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@ -727,7 +727,7 @@ rf_paritymap_attach(RF_Raid_t *raidPtr, int force)
/*
* For initializing the parity-map fields of a component label, both on
* initial creation and on reconstruct/copyback/etc. */
* initial creation and on reconstruct. */
void
rf_paritymap_init_label(struct rf_paritymap *pm, RF_ComponentLabel_t *clabel)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_raid.h,v 1.52 2023/09/17 20:07:39 oster Exp $ */
/* $NetBSD: rf_raid.h,v 1.53 2023/09/25 21:59:38 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -209,11 +209,9 @@ struct RF_Raid_s {
* Statistics
*/
RF_StripeCount_t parity_rewrite_stripes_done;
RF_StripeCount_t copyback_stripes_done;
int recon_in_progress;
int parity_rewrite_in_progress;
int copyback_in_progress;
int changing_components;
rf_declare_cond2(parity_rewrite_cv);
@ -226,7 +224,6 @@ struct RF_Raid_s {
rf_declare_cond2(node_queue_cv);
RF_DagNode_t *node_queue;
RF_Thread_t parity_rewrite_thread;
RF_Thread_t copyback_thread;
RF_Thread_t engine_thread;
RF_Thread_t engine_helper_thread;
RF_Thread_t recon_thread;

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.6 2019/02/17 04:05:57 rin Exp $
# $NetBSD: Makefile,v 1.7 2023/09/25 21:59:38 oster Exp $
.include "../Makefile.inc"
@ -9,7 +9,7 @@ IOCONF= raid.ioconf
KMOD= raid
SRCS+= rf_acctrace.c rf_alloclist.c rf_aselect.c
SRCS+= rf_callback.c rf_chaindecluster.c rf_copyback.c
SRCS+= rf_callback.c rf_chaindecluster.c
SRCS+= rf_cvscan.c rf_dagdegrd.c rf_dagdegwr.c
SRCS+= rf_dagffrd.c rf_dagffwr.c rf_dagfuncs.c
SRCS+= rf_dagutils.c rf_debugMem.c rf_debugprint.c

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.13 2019/02/06 23:00:56 christos Exp $
# $NetBSD: Makefile,v 1.14 2023/09/25 21:59:38 oster Exp $
#
.PATH: ${.CURDIR}/../../../../dev/raidframe
@ -8,7 +8,7 @@ COMMENT=RAIDframe (software RAID)
IOCONF= RAIDFRAME.ioconf
SRCS= rf_acctrace.c rf_alloclist.c rf_aselect.c rf_callback.c \
rf_chaindecluster.c rf_copyback.c rf_cvscan.c rf_dagdegrd.c \
rf_chaindecluster.c rf_cvscan.c rf_dagdegrd.c \
rf_dagdegwr.c rf_dagffrd.c rf_dagffwr.c rf_dagfuncs.c \
rf_dagutils.c rf_debugMem.c rf_debugprint.c rf_decluster.c \
rf_declusterPQ.c rf_diskqueue.c rf_disks.c rf_driver.c \