Print this page
XXXX introduce drv_sectohz


 686                         return (DDI_SUCCESS);
 687                 }
 688                 un->un_throttle = 0;
 689                 /*
 690                  * Save the last state first
 691                  */
 692                 un->un_save_state = un->un_last_state;
 693 
 694                 New_state(un, DCD_STATE_SUSPENDED);
 695 
 696                 /*
 697                  * wait till current operation completed. If we are
 698                  * in the resource wait state (with an intr outstanding)
 699                  * then we need to wait till the intr completes and
 700                  * starts the next cmd. We wait for
 701                  * DCD_WAIT_CMDS_COMPLETE seconds before failing the
 702                  * DDI_SUSPEND.
 703                  */
 704                 wait_cmds_complete = ddi_get_lbolt();
 705                 wait_cmds_complete +=
 706                     DCD_WAIT_CMDS_COMPLETE * drv_usectohz(1000000);
 707 
 708                 while (un->un_ncmds) {
 709                         if (cv_timedwait(&un->un_disk_busy_cv,
 710                             DCD_MUTEX, wait_cmds_complete) == -1) {
 711                                 /*
 712                                  * commands Didn't finish in the
 713                                  * specified time, fail the DDI_SUSPEND.
 714                                  */
 715                                 DAD_DEBUG2(DCD_DEVINFO, dcd_label,
 716                                     DCD_DEBUG, "dcddetach: SUSPEND "
 717                                     "failed due to outstanding cmds\n");
 718                                 Restore_state(un);
 719                                 mutex_exit(DCD_MUTEX);
 720                                 return (DDI_FAILURE);
 721                         }
 722                 }
 723                 mutex_exit(DCD_MUTEX);
 724                 return (DDI_SUCCESS);
 725         }
 726         return (DDI_FAILURE);




 686                         return (DDI_SUCCESS);
 687                 }
 688                 un->un_throttle = 0;
 689                 /*
 690                  * Save the last state first
 691                  */
 692                 un->un_save_state = un->un_last_state;
 693 
 694                 New_state(un, DCD_STATE_SUSPENDED);
 695 
 696                 /*
 697                  * wait till current operation completed. If we are
 698                  * in the resource wait state (with an intr outstanding)
 699                  * then we need to wait till the intr completes and
 700                  * starts the next cmd. We wait for
 701                  * DCD_WAIT_CMDS_COMPLETE seconds before failing the
 702                  * DDI_SUSPEND.
 703                  */
 704                 wait_cmds_complete = ddi_get_lbolt();
 705                 wait_cmds_complete +=
 706                     drv_sectohz(DCD_WAIT_CMDS_COMPLETE);
 707 
 708                 while (un->un_ncmds) {
 709                         if (cv_timedwait(&un->un_disk_busy_cv,
 710                             DCD_MUTEX, wait_cmds_complete) == -1) {
 711                                 /*
 712                                  * commands Didn't finish in the
 713                                  * specified time, fail the DDI_SUSPEND.
 714                                  */
 715                                 DAD_DEBUG2(DCD_DEVINFO, dcd_label,
 716                                     DCD_DEBUG, "dcddetach: SUSPEND "
 717                                     "failed due to outstanding cmds\n");
 718                                 Restore_state(un);
 719                                 mutex_exit(DCD_MUTEX);
 720                                 return (DDI_FAILURE);
 721                         }
 722                 }
 723                 mutex_exit(DCD_MUTEX);
 724                 return (DDI_SUCCESS);
 725         }
 726         return (DDI_FAILURE);