Print this page
4334 Improve ZFS N-way mirror read performance


 532         if ((error = ldi_ioctl(dvd->vd_lh, DKIOCGMEDIAINFOEXT,
 533             (intptr_t)dkmext, FKIOCTL, kcred, NULL)) == 0) {
 534                 capacity = dkmext->dki_capacity - 1;
 535                 blksz = dkmext->dki_lbsize;
 536                 pbsize = dkmext->dki_pbsize;
 537         } else if ((error = ldi_ioctl(dvd->vd_lh, DKIOCGMEDIAINFO,
 538             (intptr_t)dkm, FKIOCTL, kcred, NULL)) == 0) {
 539                 VDEV_DEBUG(
 540                     "vdev_disk_open(\"%s\"): fallback to DKIOCGMEDIAINFO\n",
 541                     vd->vdev_path);
 542                 capacity = dkm->dki_capacity - 1;
 543                 blksz = dkm->dki_lbsize;
 544                 pbsize = blksz;
 545         } else {
 546                 VDEV_DEBUG("vdev_disk_open(\"%s\"): "
 547                     "both DKIOCGMEDIAINFO{,EXT} calls failed, %d\n",
 548                     vd->vdev_path, error);
 549                 pbsize = DEV_BSIZE;
 550         }
 551 






 552         *ashift = highbit(MAX(pbsize, SPA_MINBLOCKSIZE)) - 1;
 553 
 554         if (vd->vdev_wholedisk == 1) {
 555                 int wce = 1;
 556 
 557                 if (error == 0) {
 558                         /*
 559                          * If we have the capability to expand, we'd have
 560                          * found out via success from DKIOCGMEDIAINFO{,EXT}.
 561                          * Adjust max_psize upward accordingly since we know
 562                          * we own the whole disk now.
 563                          */
 564                         *max_psize += vdev_disk_get_space(vd, capacity, blksz);
 565                         zfs_dbgmsg("capacity change: vdev %s, psize %llu, "
 566                             "max_psize %llu", vd->vdev_path, *psize,
 567                             *max_psize);
 568                 }
 569 
 570                 /*
 571                  * Since we own the whole disk, try to enable disk write




 532         if ((error = ldi_ioctl(dvd->vd_lh, DKIOCGMEDIAINFOEXT,
 533             (intptr_t)dkmext, FKIOCTL, kcred, NULL)) == 0) {
 534                 capacity = dkmext->dki_capacity - 1;
 535                 blksz = dkmext->dki_lbsize;
 536                 pbsize = dkmext->dki_pbsize;
 537         } else if ((error = ldi_ioctl(dvd->vd_lh, DKIOCGMEDIAINFO,
 538             (intptr_t)dkm, FKIOCTL, kcred, NULL)) == 0) {
 539                 VDEV_DEBUG(
 540                     "vdev_disk_open(\"%s\"): fallback to DKIOCGMEDIAINFO\n",
 541                     vd->vdev_path);
 542                 capacity = dkm->dki_capacity - 1;
 543                 blksz = dkm->dki_lbsize;
 544                 pbsize = blksz;
 545         } else {
 546                 VDEV_DEBUG("vdev_disk_open(\"%s\"): "
 547                     "both DKIOCGMEDIAINFO{,EXT} calls failed, %d\n",
 548                     vd->vdev_path, error);
 549                 pbsize = DEV_BSIZE;
 550         }
 551 
 552         /*
 553          * Determine the rotation
 554          */
 555         vd->vdev_rotation_rate = VDEV_RATE_UNKNOWN;
 556         /* TODO: Implement when there's an ioctl which provides this info. */
 557 
 558         *ashift = highbit(MAX(pbsize, SPA_MINBLOCKSIZE)) - 1;
 559 
 560         if (vd->vdev_wholedisk == 1) {
 561                 int wce = 1;
 562 
 563                 if (error == 0) {
 564                         /*
 565                          * If we have the capability to expand, we'd have
 566                          * found out via success from DKIOCGMEDIAINFO{,EXT}.
 567                          * Adjust max_psize upward accordingly since we know
 568                          * we own the whole disk now.
 569                          */
 570                         *max_psize += vdev_disk_get_space(vd, capacity, blksz);
 571                         zfs_dbgmsg("capacity change: vdev %s, psize %llu, "
 572                             "max_psize %llu", vd->vdev_path, *psize,
 573                             *max_psize);
 574                 }
 575 
 576                 /*
 577                  * Since we own the whole disk, try to enable disk write