NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/44972: raidctl -R doesn't seem to work



> - the DIOCGPART ioctl in rf_ReconstructInPlace failed with ENOTTY
>   as dk doesn't support it.

the attached patch is to fix this part of the problem.
can anyone please review and commit?  i guess it's better to use
rf_getdisksize.

YAMAMOTO Takashi
Index: rf_reconstruct.c
===================================================================
RCS file: /cvsroot/src/sys/dev/raidframe/rf_reconstruct.c,v
retrieving revision 1.115
diff -u -p -r1.115 rf_reconstruct.c
--- rf_reconstruct.c    28 May 2011 00:53:04 -0000      1.115
+++ rf_reconstruct.c    3 Aug 2011 03:44:10 -0000
@@ -348,7 +348,8 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr
        const RF_LayoutSW_t *lp;
        RF_ComponentLabel_t *c_label;
        int     numDisksDone = 0, rc;
-       struct partinfo dpart;
+       uint64_t numsec;
+       unsigned int secsize;
        struct pathbuf *pb;
        struct vnode *vp;
        struct vattr va;
@@ -464,7 +465,7 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr
                return(retcode);
        }
 
-       retcode = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, curlwp->l_cred);
+       retcode = getdisksize(vp, &numsec, &secsize);
        if (retcode) {
                vn_close(vp, FREAD | FWRITE, kauth_cred_get());
                rf_lock_mutex2(raidPtr->mutex);
@@ -474,10 +475,8 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr
                return(retcode);
        }
        rf_lock_mutex2(raidPtr->mutex);
-       raidPtr->Disks[col].blockSize = dpart.disklab->d_secsize;
-
-       raidPtr->Disks[col].numBlocks = dpart.part->p_size -
-               rf_protectedSectors;
+       raidPtr->Disks[col].blockSize = secsize;
+       raidPtr->Disks[col].numBlocks = numsec - rf_protectedSectors;
 
        raidPtr->raid_cinfo[col].ci_vp = vp;
        raidPtr->raid_cinfo[col].ci_dev = va.va_rdev;


Home | Main Index | Thread Index | Old Index