diff options
| author | mrg <mrg@NetBSD.org> | 2010-11-01 02:35:24 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2010-11-01 02:35:24 +0000 |
| commit | 4de66268a7e1af2f5dbcc5e4a6e090c93aacd374 (patch) | |
| tree | c5f905137aaaf9b6fcac460a5732bf15166c5fba /sys/dev/raidframe | |
| parent | 9a47829364528b9278c0cd586b8c30e3d6bece55 (diff) | |
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 (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/raidframevar.h | 6 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_copyback.c | 5 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_disks.c | 6 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 40 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_reconstruct.c | 6 |
5 files changed, 34 insertions, 29 deletions
diff --git a/sys/dev/raidframe/raidframevar.h b/sys/dev/raidframe/raidframevar.h index e9986f0fa48..aea4a7bd373 100644 --- a/sys/dev/raidframe/raidframevar.h +++ b/sys/dev/raidframe/raidframevar.h @@ -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 @@ typedef struct RF_ComponentLabel_s { 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 --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c index b9bd533763b..c92615678d1 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.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 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr) 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 --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c index 9997a868b17..81a22b89b46 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.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 @@ rf_AutoConfigureDisks(RF_Raid_t *raidPtr, RF_Config_t *cfgPtr, /* 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 --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 490aa8f748a..3e962017cdb 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.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 @@ raidinit(RF_Raid_t *raidPtr) 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 @@ raidstart(RF_Raid_t *raidPtr) * 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 @@ InitBP(struct buf *bp, struct vnode *b_vp, unsigned rw_flag, dev_t dev, 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 @@ rf_reasonable_label(RF_ComponentLabel_t *clabel) 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 @@ rf_print_component_label(RF_ComponentLabel_t *clabel) 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 @@ rf_does_it_fit(RF_ConfigSet_t *cset, RF_AutoConfig_t *ac) (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 @@ raid_init_component_label(RF_Raid_t *raidPtr, RF_ComponentLabel_t *clabel) 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 @@ rf_buf_queue_check(int raidid) 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); - 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); + error = getdisksize(vp, &numsecs, &secsize); 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 --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index 80d12bc35c2..2a1282ce1ee 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.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 @@ rf_ReconstructFailedDiskBasic(RF_Raid_t *raidPtr, RF_RowCol_t col) 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 |
