Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe add support for >2TB raid devices.
details: https://anonhg.NetBSD.org/src/rev/8dd308d96ec0
branches: trunk
changeset: 758304:8dd308d96ec0
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Nov 01 02:35:24 2010 +0000
description:
add support for >2TB raid devices.
- add two new members to the component label:
u_int numBlocksHi
u_int partitionSizeHi
and store the top 32 bits of the real number of blocks and
partition size. modify rf_print_component_label(),
rf_does_it_fit(), rf_AutoConfigureDisks() and
rf_ReconstructFailedDiskBasic().
- call disk_blocksize() after disk_attach() [ from mlelstv ]
- shift the block number relative to DEV_BSHIFT in raidstart()
and InitBP() so that accesses work for non 512-byte devices.
[ from mlelstv ]
- update rf_getdisksize() to use the new getdisksize() [ from
mlelstv. this part needs a separate change for netbsd-5. ]
reviewed by: oster, christos and darrenr
diffstat:
sys/dev/raidframe/raidframevar.h | 6 +++-
sys/dev/raidframe/rf_copyback.c | 5 ++-
sys/dev/raidframe/rf_disks.c | 6 +++-
sys/dev/raidframe/rf_netbsdkintf.c | 40 ++++++++++++++++++-------------------
sys/dev/raidframe/rf_reconstruct.c | 6 +++-
5 files changed, 34 insertions(+), 29 deletions(-)
diffs (213 lines):
diff -r 859794ad9dba -r 8dd308d96ec0 sys/dev/raidframe/raidframevar.h
--- a/sys/dev/raidframe/raidframevar.h Sun Oct 31 23:29:16 2010 +0000
+++ b/sys/dev/raidframe/raidframevar.h Mon Nov 01 02:35:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: raidframevar.h,v 1.13 2009/11/17 18:54:26 jld Exp $ */
+/* $NetBSD: raidframevar.h,v 1.14 2010/11/01 02:35:24 mrg Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -471,7 +471,9 @@
done first, (and would become raid0).
This may be in conflict with last_unit!!?! */
/* Not currently used. */
- int future_use2[44]; /* More future expansion */
+ u_int numBlocksHi; /* The top 32-bits of the numBlocks member. */
+ u_int partitionSizeHi;/* The top 32-bits of the partitionSize member. */
+ int future_use2[42]; /* More future expansion */
} RF_ComponentLabel_t;
typedef struct RF_SingleComponent_s {
diff -r 859794ad9dba -r 8dd308d96ec0 sys/dev/raidframe/rf_copyback.c
--- a/sys/dev/raidframe/rf_copyback.c Sun Oct 31 23:29:16 2010 +0000
+++ b/sys/dev/raidframe/rf_copyback.c Mon Nov 01 02:35:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_copyback.c,v 1.42 2009/11/17 18:54:26 jld Exp $ */
+/* $NetBSD: rf_copyback.c,v 1.43 2010/11/01 02:35:25 mrg 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.42 2009/11/17 18:54:26 jld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.43 2010/11/01 02:35:25 mrg Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -213,6 +213,7 @@
c_label->row = 0;
c_label->column = fcol;
c_label->partitionSize = raidPtr->Disks[fcol].partitionSize;
+ c_label->partitionSizeHi = raidPtr->Disks[fcol].partitionSize >> 32;
raidflush_component_label(raidPtr, fcol);
diff -r 859794ad9dba -r 8dd308d96ec0 sys/dev/raidframe/rf_disks.c
--- a/sys/dev/raidframe/rf_disks.c Sun Oct 31 23:29:16 2010 +0000
+++ b/sys/dev/raidframe/rf_disks.c Mon Nov 01 02:35:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_disks.c,v 1.73 2010/03/01 21:10:26 jld Exp $ */
+/* $NetBSD: rf_disks.c,v 1.74 2010/11/01 02:35:25 mrg Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -60,7 +60,7 @@
***************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.73 2010/03/01 21:10:26 jld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.74 2010/11/01 02:35:25 mrg Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -455,6 +455,8 @@
/* Found it. Configure it.. */
diskPtr->blockSize = ac->clabel->blockSize;
diskPtr->numBlocks = ac->clabel->numBlocks;
+ diskPtr->numBlocks |=
+ (uint64_t)ac->clabel->numBlocksHi << 32;
/* Note: rf_protectedSectors is already
factored into numBlocks here */
raidPtr->raid_cinfo[c].ci_vp = ac->vp;
diff -r 859794ad9dba -r 8dd308d96ec0 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Sun Oct 31 23:29:16 2010 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Mon Nov 01 02:35:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.274 2010/08/08 18:25:14 chs Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.275 2010/11/01 02:35:25 mrg Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -139,7 +139,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.274 2010/08/08 18:25:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.275 2010/11/01 02:35:25 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1936,6 +1936,7 @@
disk_init(&rs->sc_dkdev, rs->sc_xname, &rf_dkdriver);
disk_attach(&rs->sc_dkdev);
+ disk_blocksize(&rs->sc_dkdev, raidPtr->bytesPerSector);
/* XXX There may be a weird interaction here between this, and
* protectedSectors, as used in RAIDframe. */
@@ -2031,7 +2032,7 @@
* partition.. Need to make it absolute to the underlying
* device.. */
- blocknum = bp->b_blkno;
+ blocknum = bp->b_blkno << DEV_BSHIFT >> raidPtr->logBytesPerSector;
if (DISKPART(bp->b_dev) != RAW_PART) {
pp = &rs->sc_dkdev.dk_label->d_partitions[DISKPART(bp->b_dev)];
blocknum += pp->p_offset;
@@ -2283,7 +2284,7 @@
bp->b_error = 0;
bp->b_dev = dev;
bp->b_data = bf;
- bp->b_blkno = startSect;
+ bp->b_blkno = startSect << logBytesPerSector >> DEV_BSHIFT;
bp->b_resid = bp->b_bcount; /* XXX is this right!??!?!! */
if (bp->b_bcount == 0) {
panic("bp->b_bcount is zero in InitBP!!");
@@ -3136,6 +3137,10 @@
void
rf_print_component_label(RF_ComponentLabel_t *clabel)
{
+ uint64_t numBlocks = clabel->numBlocks;
+
+ numBlocks |= (uint64_t)clabel->numBlocksHi << 32;
+
printf(" Row: %d Column: %d Num Rows: %d Num Columns: %d\n",
clabel->row, clabel->column,
clabel->num_rows, clabel->num_columns);
@@ -3146,9 +3151,8 @@
clabel->clean ? "Yes" : "No", clabel->status);
printf(" sectPerSU: %d SUsPerPU: %d SUsPerRU: %d\n",
clabel->sectPerSU, clabel->SUsPerPU, clabel->SUsPerRU);
- printf(" RAID Level: %c blocksize: %d numBlocks: %d\n",
- (char) clabel->parityConfig, clabel->blockSize,
- clabel->numBlocks);
+ 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");
@@ -3269,6 +3273,7 @@
(clabel1->maxOutstanding == clabel2->maxOutstanding) &&
(clabel1->blockSize == clabel2->blockSize) &&
(clabel1->numBlocks == clabel2->numBlocks) &&
+ (clabel1->numBlocksHi == clabel2->numBlocksHi) &&
(clabel1->autoconfigure == clabel2->autoconfigure) &&
(clabel1->root_partition == clabel2->root_partition) &&
(clabel1->last_unit == clabel2->last_unit) &&
@@ -3533,6 +3538,7 @@
clabel->blockSize = raidPtr->bytesPerSector;
clabel->numBlocks = raidPtr->sectorsPerDisk;
+ clabel->numBlocksHi = raidPtr->sectorsPerDisk >> 32;
/* XXX not portable */
clabel->parityConfig = raidPtr->Layout.map->parityConfig;
@@ -3691,23 +3697,15 @@
int
rf_getdisksize(struct vnode *vp, struct lwp *l, RF_RaidDisk_t *diskPtr)
{
- struct partinfo dpart;
- struct dkwedge_info dkw;
+ uint64_t numsecs;
+ unsigned secsize;
int error;
- error = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, l->l_cred);
+ error = getdisksize(vp, &numsecs, &secsize);
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);
- if (error == 0) {
- diskPtr->blockSize = 512; /* XXX */
- diskPtr->numBlocks = dkw.dkw_size - rf_protectedSectors;
- diskPtr->partitionSize = dkw.dkw_size;
+ diskPtr->blockSize = secsize;
+ diskPtr->numBlocks = numsecs - rf_protectedSectors;
+ diskPtr->partitionSize = numsecs;
return 0;
}
return error;
diff -r 859794ad9dba -r 8dd308d96ec0 sys/dev/raidframe/rf_reconstruct.c
--- a/sys/dev/raidframe/rf_reconstruct.c Sun Oct 31 23:29:16 2010 +0000
+++ b/sys/dev/raidframe/rf_reconstruct.c Mon Nov 01 02:35:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconstruct.c,v 1.108 2009/11/17 18:54:26 jld Exp $ */
+/* $NetBSD: rf_reconstruct.c,v 1.109 2010/11/01 02:35:25 mrg 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.108 2009/11/17 18:54:26 jld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.109 2010/11/01 02:35:25 mrg Exp $");
#include <sys/param.h>
#include <sys/time.h>
@@ -297,6 +297,8 @@
c_label->clean = RF_RAID_DIRTY;
c_label->status = rf_ds_optimal;
c_label->partitionSize = raidPtr->Disks[scol].partitionSize;
+ c_label->partitionSizeHi =
+ raidPtr->Disks[scol].partitionSize >> 32;
/* We've just done a rebuild based on all the other
disks, so at this point the parity is known to be
Home |
Main Index |
Thread Index |
Old Index