Hi,

cgd(4) currently cannot run on top of zvol because getdisksize() fails
on zvols. Would this patch be acceptable for now? I think the block
size needs to come from somewhere else, but it doesn't look like our
zfs currently has support for setting e.g. ashift=12 anyway.

--- sys/kern/subr_disk_open.c   20 Feb 2019 10:02:51 -0000      1.14
+++ sys/kern/subr_disk_open.c   9 Nov 2019 11:30:04 -0000
@@ -105,8 +105,10 @@ getdisksize(struct vnode *vp, uint64_t *
         */
        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

Kind regards,
-Tobias

Reply via email to