tech-kern archive

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

Re: fix getdisksize() for zfs zvols



tnn%NetBSD.org@localhost (Tobias Nygren) writes:

>Hi,

> 	error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED);
> 	if (error == 0) {
>-		pdk = disk_find(dkw.dkw_parent);
>-		if (pdk != NULL) {
>+		if (!strcmp("ZFS", dkw.dkw_parent)) {
>+			secsize = DEV_BSIZE;	/* XXX */
>+			numsec = dkw.dkw_size;
>+		} else if ((pdk = disk_find(dkw.dkw_parent)) != NULL) {
> 			secsize = DEV_BSIZE << pdk->dk_blkshift;
> 			numsec  = dkw.dkw_size;
> 		} else

That alone is ugly, the fake parent device is worse. The DIOCGWEDGEINFO
ioctl for zvols should be deleted.

What we can do is adding a fallback for the DIOCSECTORSIZE and DIOCGMEDIASIZE
ioctls to getdisksize().

-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index