summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2006-08-27 05:07:12 +0000
committerchristos <christos@NetBSD.org>2006-08-27 05:07:12 +0000
commitecdff16f80ddbb2eb25ddcb32fcf635f4df0f633 (patch)
treec28be7824bd68576c2eeeb0e061bdb3de81ef0c6 /sys/dev/raidframe
parentda01e9eb57bb5f18c42052d3e99341d687be93ef (diff)
- use dk_lookup instead of our home-spun version.
- allow raid to be configured in a wedge - allow wedges to be configured in a raid - add autoconfiguration of wedges in a raid
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_copyback.c16
-rw-r--r--sys/dev/raidframe/rf_disks.c19
-rw-r--r--sys/dev/raidframe/rf_kintf.h4
-rw-r--r--sys/dev/raidframe/rf_netbsd.h4
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c293
-rw-r--r--sys/dev/raidframe/rf_reconstruct.c8
6 files changed, 191 insertions, 153 deletions
diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c
index 5027b51ad55..64e6c338ed7 100644
--- a/sys/dev/raidframe/rf_copyback.c
+++ b/sys/dev/raidframe/rf_copyback.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_copyback.c,v 1.34 2006/07/21 16:48:52 ad Exp $ */
+/* $NetBSD: rf_copyback.c,v 1.35 2006/08/27 05:07:12 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -38,7 +38,7 @@
****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.34 2006/07/21 16:48:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.35 2006/08/27 05:07:12 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -94,7 +94,6 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
RF_RaidDisk_t *badDisk;
char *databuf;
- struct partinfo dpart;
struct vnode *vp;
struct vattr va;
struct lwp *l;
@@ -138,10 +137,10 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
printf("About to (re-)open the device: %s\n",
raidPtr->Disks[fcol].devname);
- retcode = raidlookup(raidPtr->Disks[fcol].devname, l, &vp);
+ retcode = dk_lookup(raidPtr->Disks[fcol].devname, l, &vp);
if (retcode) {
- printf("raid%d: copyback: raidlookup on device: %s failed: %d!\n",
+ printf("raid%d: copyback: dk_lookup on device: %s failed: %d!\n",
raidPtr->raidid, raidPtr->Disks[fcol].devname,
retcode);
@@ -156,15 +155,10 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
if ((retcode = VOP_GETATTR(vp, &va, l->l_cred, l)) != 0)
return;
- retcode = VOP_IOCTL(vp, DIOCGPART, &dpart,
- FREAD, l->l_cred, l);
+ retcode = rf_getdisksize(vp, l, &raidPtr->Disks[fcol]);
if (retcode) {
return;
}
- raidPtr->Disks[fcol].blockSize = dpart.disklab->d_secsize;
-
- raidPtr->Disks[fcol].numBlocks = dpart.part->p_size -
- rf_protectedSectors;
raidPtr->raid_cinfo[fcol].ci_vp = vp;
raidPtr->raid_cinfo[fcol].ci_dev = va.va_rdev;
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c
index 860f2c9189d..7026a663455 100644
--- a/sys/dev/raidframe/rf_disks.c
+++ b/sys/dev/raidframe/rf_disks.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_disks.c,v 1.61 2006/07/21 16:48:52 ad Exp $ */
+/* $NetBSD: rf_disks.c,v 1.62 2006/08/27 05:07:12 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -67,7 +67,7 @@
***************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.61 2006/07/21 16:48:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.62 2006/08/27 05:07:12 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -575,7 +575,6 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *bf, RF_RaidDisk_t *diskPtr,
RF_RowCol_t col)
{
char *p;
- struct partinfo dpart;
struct vnode *vp;
struct vattr va;
struct lwp *l;
@@ -603,9 +602,9 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *bf, RF_RaidDisk_t *diskPtr,
return (0);
}
- error = raidlookup(diskPtr->devname, l, &vp);
+ error = dk_lookup(diskPtr->devname, l, &vp);
if (error) {
- printf("raidlookup on device: %s failed!\n", diskPtr->devname);
+ printf("dk_lookup on device: %s failed!\n", diskPtr->devname);
if (error == ENXIO) {
/* the component isn't there... must be dead :-( */
diskPtr->status = rf_ds_failed;
@@ -617,16 +616,8 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *bf, RF_RaidDisk_t *diskPtr,
if ((error = VOP_GETATTR(vp, &va, l->l_cred, l)) != 0)
return (error);
- error = VOP_IOCTL(vp, DIOCGPART, &dpart,
- FREAD, l->l_cred, l);
- if (error) {
+ if ((error = rf_getdisksize(vp, l, diskPtr)) != 0)
return (error);
- }
-
- diskPtr->blockSize = dpart.disklab->d_secsize;
-
- diskPtr->numBlocks = dpart.part->p_size - rf_protectedSectors;
- diskPtr->partitionSize = dpart.part->p_size;
raidPtr->raid_cinfo[col].ci_vp = vp;
raidPtr->raid_cinfo[col].ci_dev = va.va_rdev;
diff --git a/sys/dev/raidframe/rf_kintf.h b/sys/dev/raidframe/rf_kintf.h
index 3833fc97cd3..27653392932 100644
--- a/sys/dev/raidframe/rf_kintf.h
+++ b/sys/dev/raidframe/rf_kintf.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_kintf.h,v 1.19 2005/12/11 12:23:37 christos Exp $ */
+/* $NetBSD: rf_kintf.h,v 1.20 2006/08/27 05:07:12 christos Exp $ */
/*
* rf_kintf.h
*
@@ -47,7 +47,6 @@ int raidread_component_label(dev_t, struct vnode *, RF_ComponentLabel_t *);
#define RF_NORMAL_COMPONENT_UPDATE 0
#define RF_FINAL_COMPONENT_UPDATE 1
void rf_update_component_labels(RF_Raid_t *, int);
-int raidlookup(char *, struct lwp *, struct vnode **);
int raidmarkclean(dev_t dev, struct vnode *b_vp, int);
int raidmarkdirty(dev_t dev, struct vnode *b_vp, int);
void raid_init_component_label(RF_Raid_t *, RF_ComponentLabel_t *);
@@ -55,4 +54,5 @@ 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 *, struct lwp *, RF_RaidDisk_t *);
#endif /* _RF__RF_KINTF_H_ */
diff --git a/sys/dev/raidframe/rf_netbsd.h b/sys/dev/raidframe/rf_netbsd.h
index 0b3cbf7f9ca..f40fda5a56e 100644
--- a/sys/dev/raidframe/rf_netbsd.h
+++ b/sys/dev/raidframe/rf_netbsd.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsd.h,v 1.26 2006/01/07 16:08:44 oster Exp $ */
+/* $NetBSD: rf_netbsd.h,v 1.27 2006/08/27 05:07:13 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,9 @@
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/pool.h>
+#include <sys/disk.h>
+#include <dev/dkvar.h>
#include <dev/raidframe/raidframevar.h>
struct raidcinfo {
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index 5785dbca476..e100acaae60 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.212 2006/08/07 20:02:22 oster Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.213 2006/08/27 05:07:13 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -146,7 +146,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.212 2006/08/07 20:02:22 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.213 2006/08/27 05:07:13 christos Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@@ -396,6 +396,8 @@ raidattach(int num)
raidrootdev[raidID].dv_cfdriver = &raid_cd;
snprintf(raidrootdev[raidID].dv_xname,
sizeof(raidrootdev[raidID].dv_xname), "raid%d", raidID);
+ raid_softc[raidID].sc_dkdev.dk_name =
+ raidrootdev[raidID].dv_xname;
RF_Malloc(raidPtrs[raidID], sizeof(RF_Raid_t),
(RF_Raid_t *));
@@ -423,6 +425,7 @@ rf_autoconfig(struct device *self)
{
RF_AutoConfig_t *ac_list;
RF_ConfigSet_t *config_sets;
+ int i;
if (raidautoconfig == 0)
return (0);
@@ -445,7 +448,11 @@ rf_autoconfig(struct device *self)
*/
rf_buildroothack(config_sets);
- return (1);
+ for (i = 0; i < numraid; i++)
+ if (raidPtrs[i] != NULL && raidPtrs[i]->valid)
+ dkwedge_discover(&raid_softc[i].sc_dkdev);
+
+ return 1;
}
void
@@ -467,6 +474,9 @@ rf_buildroothack(RF_ConfigSet_t *config_sets)
cset->ac->clabel->autoconfigure==1) {
retcode = rf_auto_config_set(cset,&raidID);
if (!retcode) {
+#ifdef DEBUG
+ printf("raid%d: configured ok\n", raidID);
+#endif
if (cset->rootable) {
rootID = raidID;
num_root++;
@@ -479,6 +489,9 @@ rf_buildroothack(RF_ConfigSet_t *config_sets)
rf_release_all_vps(cset);
}
} else {
+#ifdef DEBUG
+ printf("raid%d: not enough components\n", raidID);
+#endif
/* we're not autoconfiguring this set...
release the associated resources */
rf_release_all_vps(cset);
@@ -559,6 +572,15 @@ raidopen(dev_t dev, int flags, int fmt, struct lwp *l)
lp = rs->sc_dkdev.dk_label;
part = DISKPART(dev);
+
+ /*
+ * If there are wedges, and this is not RAW_PART, then we
+ * need to fail.
+ */
+ if (rs->sc_dkdev.dk_nwedges != 0 && part != RAW_PART) {
+ error = EBUSY;
+ goto bad;
+ }
pmask = (1 << part);
if ((rs->sc_flags & RAIDF_INITED) &&
@@ -572,8 +594,7 @@ raidopen(dev_t dev, int flags, int fmt, struct lwp *l)
((part >= lp->d_npartitions) ||
(lp->d_partitions[part].p_fstype == FS_UNUSED))) {
error = ENXIO;
- raidunlock(rs);
- return (error);
+ goto bad;
}
}
/* Prevent this unit from being unconfigured while open. */
@@ -604,6 +625,7 @@ raidopen(dev_t dev, int flags, int fmt, struct lwp *l)
rs->sc_dkdev.dk_openmask =
rs->sc_dkdev.dk_copenmask | rs->sc_dkdev.dk_bopenmask;
+bad:
raidunlock(rs);
return (error);
@@ -804,6 +826,7 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
#ifdef __HAVE_OLD_DISKLABEL
struct disklabel newlabel;
#endif
+ struct dkwedge_info *dkw;
if (unit >= numraid)
return (ENXIO);
@@ -815,6 +838,15 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
/* Must be open for writes for these commands... */
switch (cmd) {
+#ifdef DIOCGSECTORSIZE
+ case DIOCGSECTORSIZE:
+ *(u_int *)data = raidPtr->bytesPerSector;
+ return 0;
+ case DIOCGMEDIASIZE:
+ *(off_t *)data =
+ (off_t)raidPtr->totalSectors * raidPtr->bytesPerSector;
+ return 0;
+#endif
case DIOCSDINFO:
case DIOCWDINFO:
#ifdef __HAVE_OLD_DISKLABEL
@@ -822,6 +854,8 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
case ODIOCSDINFO:
#endif
case DIOCWLABEL:
+ case DIOCAWEDGE:
+ case DIOCDWEDGE:
if ((flag & FWRITE) == 0)
return (EBADF);
}
@@ -840,6 +874,9 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
case DIOCGPART:
case DIOCWLABEL:
case DIOCGDEFLABEL:
+ case DIOCAWEDGE:
+ case DIOCDWEDGE:
+ case DIOCLWEDGES:
case RAIDFRAME_SHUTDOWN:
case RAIDFRAME_REWRITEPARITY:
case RAIDFRAME_GET_INFO:
@@ -1591,6 +1628,18 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l)
break;
#endif
+ case DIOCAWEDGE:
+ case DIOCDWEDGE:
+ dkw = (void *)data;
+
+ /* If the ioctl happens here, the parent is us. */
+ (void)strcpy(dkw->dkw_parent, rs->sc_xname);
+ return cmd == DIOCAWEDGE ? dkwedge_add(dkw) : dkwedge_del(dkw);
+
+ case DIOCLWEDGES:
+ return dkwedge_list(&rs->sc_dkdev,
+ (struct dkwedge_list *)data, l);
+
default:
retcode = ENOTTY;
}
@@ -2095,48 +2144,6 @@ raidmakedisklabel(struct raid_softc *rs)
lp->d_checksum = dkcksum(lp);
}
/*
- * Lookup the provided name in the filesystem. If the file exists,
- * is a valid block device, and isn't being used by anyone else,
- * set *vpp to the file's vnode.
- * You'll find the original of this in ccd.c
- */
-int
-raidlookup(char *path, struct lwp *l, struct vnode **vpp)
-{
- struct nameidata nd;
- struct vnode *vp;
- struct vattr va;
- int error;
-
- if (l == NULL)
- return(ESRCH); /* Is ESRCH the best choice? */
-
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, l);
- if ((error = vn_open(&nd, FREAD | FWRITE, 0)) != 0) {
- return (error);
- }
- vp = nd.ni_vp;
- if (vp->v_usecount > 1) {
- VOP_UNLOCK(vp, 0);
- (void) vn_close(vp, FREAD | FWRITE, l->l_cred, l);
- return (EBUSY);
- }
- if ((error = VOP_GETATTR(vp, &va, l->l_cred, l)) != 0) {
- VOP_UNLOCK(vp, 0);
- (void) vn_close(vp, FREAD | FWRITE, l->l_cred, l);
- return (error);
- }
- /* XXX: eventually we should handle VREG, too. */
- if (va.va_type != VBLK) {
- VOP_UNLOCK(vp, 0);
- (void) vn_close(vp, FREAD | FWRITE, l->l_cred, l);
- return (ENOTBLK);
- }
- VOP_UNLOCK(vp, 0);
- *vpp = vp;
- return (0);
-}
-/*
* Wait interruptibly for an exclusive lock.
*
* XXX
@@ -2580,6 +2587,63 @@ rf_ReconstructInPlaceThread(struct rf_recon_req *req)
kthread_exit(0); /* does not return */
}
+static RF_AutoConfig_t *
+rf_get_component(RF_AutoConfig_t *ac_list, dev_t dev, struct vnode *vp,
+ const char *cname, RF_SectorCount_t size)
+{
+ int good_one = 0;
+ RF_ComponentLabel_t *clabel;
+ RF_AutoConfig_t *ac;
+
+ clabel = malloc(sizeof(RF_ComponentLabel_t), M_RAIDFRAME, M_NOWAIT);
+ if (clabel == NULL) {
+oomem:
+ while(ac_list) {
+ ac = ac_list;
+ if (ac->clabel)
+ free(ac->clabel, M_RAIDFRAME);
+ ac_list = ac_list->next;
+ free(ac, M_RAIDFRAME);
+ }
+ printf("RAID auto config: out of memory!\n");
+ return NULL; /* XXX probably should panic? */
+ }
+
+ if (!raidread_component_label(dev, vp, clabel)) {
+ /* Got the label. Does it look reasonable? */
+ if (rf_reasonable_label(clabel) &&
+ (clabel->partitionSize <= size)) {
+#if DEBUG
+ printf("Component on: %s: %llu\n",
+ cname, (unsigned long long)size);
+ rf_print_component_label(clabel);
+#endif
+ /* if it's reasonable, add it, else ignore it. */
+ ac = malloc(sizeof(RF_AutoConfig_t), M_RAIDFRAME,
+ M_NOWAIT);
+ if (ac == NULL) {
+ free(clabel, M_RAIDFRAME);
+ goto oomem;
+ }
+ strlcpy(ac->devname, cname, sizeof(ac->devname));
+ ac->dev = dev;
+ ac->vp = vp;
+ ac->clabel = clabel;
+ ac->next = ac_list;
+ ac_list = ac;
+ good_one = 1;
+ }
+ }
+ if (!good_one) {
+ /* cleanup */
+ free(clabel, M_RAIDFRAME);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, 0);
+ vput(vp);
+ }
+ return ac_list;
+}
+
RF_AutoConfig_t *
rf_find_raid_components()
{
@@ -2587,13 +2651,10 @@ rf_find_raid_components()
struct disklabel label;
struct device *dv;
dev_t dev;
- int bmajor;
+ int bmajor, bminor, wedge;
int error;
int i;
- int good_one;
- RF_ComponentLabel_t *clabel;
RF_AutoConfig_t *ac_list;
- RF_AutoConfig_t *ac;
/* initialize the AutoConfig list */
@@ -2633,7 +2694,10 @@ rf_find_raid_components()
/* get a vnode for the raw partition of this disk */
- dev = MAKEDISKDEV(bmajor, device_unit(dv), RAW_PART);
+ wedge = device_is_a(dv, "dk");
+ bminor = minor(device_unit(dv));
+ dev = wedge ? makedev(bmajor, bminor) :
+ MAKEDISKDEV(bmajor, bminor, RAW_PART);
if (bdevvp(dev, &vp))
panic("RAID can't alloc vnode");
@@ -2646,6 +2710,28 @@ rf_find_raid_components()
continue;
}
+ if (wedge) {
+ struct dkwedge_info dkw;
+ error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD,
+ NOCRED, 0);
+ if (error) {
+ printf("RAIDframe: can't get wedge info for "
+ "dev %s (%d)\n", dv->dv_xname, error);
+out:
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, 0);
+ vput(vp);
+ continue;
+ }
+
+ if (strcmp(dkw.dkw_ptype, DKW_PTYPE_RAIDFRAME) != 0)
+ goto out;
+
+ ac_list = rf_get_component(ac_list, dev, vp,
+ dv->dv_xname, dkw.dkw_size);
+ continue;
+ }
+
/* Ok, the disk exists. Go get the disklabel. */
error = VOP_IOCTL(vp, DIOCGDINFO, &label, FREAD, NOCRED, 0);
if (error) {
@@ -2667,7 +2753,9 @@ rf_find_raid_components()
if (error)
continue;
- for (i=0; i < label.d_npartitions; i++) {
+ for (i = 0; i < label.d_npartitions; i++) {
+ char cname[sizeof(ac_list->devname)];
+
/* We only support partitions marked as RAID */
if (label.d_partitions[i].p_fstype != FS_RAID)
continue;
@@ -2682,78 +2770,16 @@ rf_find_raid_components()
vput(vp);
continue;
}
-
- good_one = 0;
-
- clabel = (RF_ComponentLabel_t *)
- malloc(sizeof(RF_ComponentLabel_t),
- M_RAIDFRAME, M_NOWAIT);
- if (clabel == NULL) {
- while(ac_list) {
- ac = ac_list;
- if (ac->clabel)
- free(ac->clabel, M_RAIDFRAME);
- ac_list = ac_list->next;
- free(ac, M_RAIDFRAME);
- };
- printf("RAID auto config: out of memory!\n");
- return(NULL); /* XXX probably should panic? */
- }
-
- if (!raidread_component_label(dev, vp, clabel)) {
- /* Got the label. Does it look reasonable? */
- if (rf_reasonable_label(clabel) &&
- (clabel->partitionSize <=
- label.d_partitions[i].p_size)) {
-#if DEBUG
- printf("Component on: %s%c: %d\n",
- dv->dv_xname, 'a'+i,
- label.d_partitions[i].p_size);
- rf_print_component_label(clabel);
-#endif
- /* if it's reasonable, add it,
- else ignore it. */
- ac = (RF_AutoConfig_t *)
- malloc(sizeof(RF_AutoConfig_t),
- M_RAIDFRAME,
- M_NOWAIT);
- if (ac == NULL) {
- /* XXX should panic?? */
- while(ac_list) {
- ac = ac_list;
- if (ac->clabel)
- free(ac->clabel,
- M_RAIDFRAME);
- ac_list = ac_list->next;
- free(ac, M_RAIDFRAME);
- }
- free(clabel, M_RAIDFRAME);
- return(NULL);
- }
-
- snprintf(ac->devname,
- sizeof(ac->devname), "%s%c",
- dv->dv_xname, 'a'+i);
- ac->dev = dev;
- ac->vp = vp;
- ac->clabel = clabel;
- ac->next = ac_list;
- ac_list = ac;
- good_one = 1;
- }
- }
- if (!good_one) {
- /* cleanup */
- free(clabel, M_RAIDFRAME);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- VOP_CLOSE(vp, FREAD | FWRITE, NOCRED, 0);
- vput(vp);
- }
+ snprintf(cname, sizeof(cname), "%s%c",
+ dv->dv_xname, 'a' + i);
+ ac_list = rf_get_component(ac_list, dev, vp, cname,
+ label.d_partitions[i].p_size);
}
}
- return(ac_list);
+ return ac_list;
}
+
static int
rf_reasonable_label(RF_ComponentLabel_t *clabel)
{
@@ -3339,3 +3365,28 @@ rf_buf_queue_check(int raidid)
/* default is nothing to do */
return 1;
}
+
+int
+rf_getdisksize(struct vnode *vp, struct lwp *l, RF_RaidDisk_t *diskPtr)
+{
+ struct partinfo dpart;
+ struct dkwedge_info dkw;
+ int error;
+
+ error = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, l->l_cred, l);
+ if (error == 0) {
+ diskPtr->blockSize = dpart.disklab->d_secsize;
+ diskPtr->numBlocks = dpart.part->p_size - rf_protectedSectors;
+ diskPtr->partitionSize = dpart.part->p_size;
+ return 0;
+ }
+
+ error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, l->l_cred, l);
+ if (error == 0) {
+ diskPtr->blockSize = 512; /* XXX */
+ diskPtr->numBlocks = dkw.dkw_size - rf_protectedSectors;
+ diskPtr->partitionSize = dkw.dkw_size;
+ return 0;
+ }
+ return error;
+}
diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c
index 71bf2517ee8..f231dc07871 100644
--- a/sys/dev/raidframe/rf_reconstruct.c
+++ b/sys/dev/raidframe/rf_reconstruct.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconstruct.c,v 1.92 2006/07/21 16:48:52 ad Exp $ */
+/* $NetBSD: rf_reconstruct.c,v 1.93 2006/08/27 05:07:13 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.92 2006/07/21 16:48:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.93 2006/08/27 05:07:13 christos Exp $");
#include <sys/time.h>
#include <sys/buf.h>
@@ -438,10 +438,10 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col)
raidPtr->Disks[col].devname);
#endif
RF_UNLOCK_MUTEX(raidPtr->mutex);
- retcode = raidlookup(raidPtr->Disks[col].devname, lwp, &vp);
+ retcode = dk_lookup(raidPtr->Disks[col].devname, lwp, &vp);
if (retcode) {
- printf("raid%d: rebuilding: raidlookup on device: %s failed: %d!\n",raidPtr->raidid,
+ printf("raid%d: rebuilding: dk_lookup on device: %s failed: %d!\n",raidPtr->raidid,
raidPtr->Disks[col].devname, retcode);
/* the component isn't responding properly...