Module Name: src Committed By: riz Date: Sun Nov 21 22:06:54 UTC 2010
Modified Files: src/sys/dev/raidframe [netbsd-5]: raidframevar.h rf_copyback.c rf_disks.c rf_netbsdkintf.c rf_reconstruct.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1468): sys/dev/raidframe/rf_disks.c: revision 1.74 sys/dev/raidframe/raidframevar.h: revision 1.14 sys/dev/raidframe/rf_netbsdkintf.c: revision 1.275 sys/dev/raidframe/rf_copyback.c: revision 1.43 sys/dev/raidframe/rf_reconstruct.c: revision 1.109 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 To generate a diff of this commit: cvs rdiff -u -r1.12.10.1 -r1.12.10.2 src/sys/dev/raidframe/raidframevar.h cvs rdiff -u -r1.41.20.1 -r1.41.20.2 src/sys/dev/raidframe/rf_copyback.c cvs rdiff -u -r1.70.10.2 -r1.70.10.3 src/sys/dev/raidframe/rf_disks.c cvs rdiff -u -r1.250.4.7 -r1.250.4.8 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.105.4.3 -r1.105.4.4 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.12.10.1 src/sys/dev/raidframe/raidframevar.h:1.12.10.2 --- src/sys/dev/raidframe/raidframevar.h:1.12.10.1 Thu Dec 10 22:59:16 2009 +++ src/sys/dev/raidframe/raidframevar.h Sun Nov 21 22:06:53 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: raidframevar.h,v 1.12.10.1 2009/12/10 22:59:16 snj Exp $ */ +/* $NetBSD: raidframevar.h,v 1.12.10.2 2010/11/21 22:06:53 riz 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 { Index: src/sys/dev/raidframe/rf_copyback.c diff -u src/sys/dev/raidframe/rf_copyback.c:1.41.20.1 src/sys/dev/raidframe/rf_copyback.c:1.41.20.2 --- src/sys/dev/raidframe/rf_copyback.c:1.41.20.1 Thu Dec 10 22:59:16 2009 +++ src/sys/dev/raidframe/rf_copyback.c Sun Nov 21 22:06:53 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_copyback.c,v 1.41.20.1 2009/12/10 22:59:16 snj Exp $ */ +/* $NetBSD: rf_copyback.c,v 1.41.20.2 2010/11/21 22:06:53 riz 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.41.20.1 2009/12/10 22:59:16 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.41.20.2 2010/11/21 22:06:53 riz 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); Index: src/sys/dev/raidframe/rf_disks.c diff -u src/sys/dev/raidframe/rf_disks.c:1.70.10.2 src/sys/dev/raidframe/rf_disks.c:1.70.10.3 --- src/sys/dev/raidframe/rf_disks.c:1.70.10.2 Thu Dec 10 22:59:16 2009 +++ src/sys/dev/raidframe/rf_disks.c Sun Nov 21 22:06:53 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.70.10.2 2009/12/10 22:59:16 snj Exp $ */ +/* $NetBSD: rf_disks.c,v 1.70.10.3 2010/11/21 22:06:53 riz 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.70.10.2 2009/12/10 22:59:16 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.70.10.3 2010/11/21 22:06:53 riz Exp $"); #include <dev/raidframe/raidframevar.h> @@ -453,6 +453,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; Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.250.4.7 src/sys/dev/raidframe/rf_netbsdkintf.c:1.250.4.8 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.250.4.7 Sat Nov 20 17:41:26 2010 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Nov 21 22:06:53 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.250.4.7 2010/11/20 17:41:26 riz Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.250.4.8 2010/11/21 22:06:53 riz 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.250.4.7 2010/11/20 17:41:26 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.250.4.8 2010/11/21 22:06:53 riz Exp $"); #include <sys/param.h> #include <sys/errno.h> @@ -1886,6 +1886,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. */ @@ -1981,7 +1982,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; @@ -2242,7 +2243,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!!"); @@ -3093,6 +3094,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); @@ -3103,9 +3108,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" ); @@ -3226,6 +3230,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) && @@ -3490,6 +3495,7 @@ clabel->blockSize = raidPtr->bytesPerSector; clabel->numBlocks = raidPtr->sectorsPerDisk; + clabel->numBlocksHi = raidPtr->sectorsPerDisk >> 32; /* XXX not portable */ clabel->parityConfig = raidPtr->Layout.map->parityConfig; @@ -3662,7 +3668,12 @@ error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, l->l_cred); if (error == 0) { - diskPtr->blockSize = 512; /* XXX */ + struct disk *pdk; + + if ((pdk = disk_find(dkw.dkw_parent)) != NULL) + diskPtr->blockSize = DEV_BSIZE << pdk->dk_blkshift; + else + diskPtr->blockSize = 512; /* XXX */ diskPtr->numBlocks = dkw.dkw_size - rf_protectedSectors; diskPtr->partitionSize = dkw.dkw_size; return 0; Index: src/sys/dev/raidframe/rf_reconstruct.c diff -u src/sys/dev/raidframe/rf_reconstruct.c:1.105.4.3 src/sys/dev/raidframe/rf_reconstruct.c:1.105.4.4 --- src/sys/dev/raidframe/rf_reconstruct.c:1.105.4.3 Thu Dec 10 22:59:17 2009 +++ src/sys/dev/raidframe/rf_reconstruct.c Sun Nov 21 22:06:53 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconstruct.c,v 1.105.4.3 2009/12/10 22:59:17 snj Exp $ */ +/* $NetBSD: rf_reconstruct.c,v 1.105.4.4 2010/11/21 22:06:53 riz 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.105.4.3 2009/12/10 22:59:17 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.105.4.4 2010/11/21 22:06:53 riz 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