Print this page
XXXX introduce drv_sectohz


 922         }
 923         task = ap->a_active_task;
 924         task->ts_ses = sp;
 925         task->ts_state = SBP2_TASK_PEND;
 926 
 927         /* can't work with a dead agent */
 928         if (sbp2_agent_keepalive(ap, &task->ts_bus_error) != SBP2_SUCCESS) {
 929                 task->ts_error = SBP2_TASK_ERR_DEAD;
 930                 goto error;
 931         }
 932 
 933         /*
 934          * In theory, we should schedule task timeout after it's been submitted.
 935          * However, some fast tasks complete even before timeout is scheduled.
 936          * To avoid additional complications in the code, schedule timeout now.
 937          */
 938         ASSERT(task->ts_timeout_id == 0);
 939         task->ts_time_start = gethrtime();
 940         if (task->ts_timeout > 0) {
 941                 task->ts_timeout_id = timeout(sbp2_task_timeout, task,
 942                     task->ts_timeout * drv_usectohz(1000000));
 943         }
 944 
 945         /* notify fetch agent */
 946         ap->a_state = SBP2_AGENT_STATE_ACTIVE;
 947         mutex_exit(&ap->a_mutex);
 948         ret = sbp2_agent_write_orbp(ap, task->ts_buf->bb_baddr,
 949             &task->ts_bus_error);
 950         tp->t_stat.stat_submit_orbp++;
 951         mutex_enter(&ap->a_mutex);
 952 
 953         if (ret != SBP2_SUCCESS) {
 954                 ap->a_state = SBP2_AGENT_STATE_DEAD;
 955                 tp->t_stat.stat_status_dead++;
 956 
 957                 if (task->ts_timeout_id != 0) {
 958                         timeout_id = task->ts_timeout_id;
 959                         task->ts_timeout_id = 0;
 960                         (void) untimeout(timeout_id);
 961                 }
 962                 task->ts_error = SBP2_TASK_ERR_BUS;




 922         }
 923         task = ap->a_active_task;
 924         task->ts_ses = sp;
 925         task->ts_state = SBP2_TASK_PEND;
 926 
 927         /* can't work with a dead agent */
 928         if (sbp2_agent_keepalive(ap, &task->ts_bus_error) != SBP2_SUCCESS) {
 929                 task->ts_error = SBP2_TASK_ERR_DEAD;
 930                 goto error;
 931         }
 932 
 933         /*
 934          * In theory, we should schedule task timeout after it's been submitted.
 935          * However, some fast tasks complete even before timeout is scheduled.
 936          * To avoid additional complications in the code, schedule timeout now.
 937          */
 938         ASSERT(task->ts_timeout_id == 0);
 939         task->ts_time_start = gethrtime();
 940         if (task->ts_timeout > 0) {
 941                 task->ts_timeout_id = timeout(sbp2_task_timeout, task,
 942                     drv_sectohz(task->ts_timeout));
 943         }
 944 
 945         /* notify fetch agent */
 946         ap->a_state = SBP2_AGENT_STATE_ACTIVE;
 947         mutex_exit(&ap->a_mutex);
 948         ret = sbp2_agent_write_orbp(ap, task->ts_buf->bb_baddr,
 949             &task->ts_bus_error);
 950         tp->t_stat.stat_submit_orbp++;
 951         mutex_enter(&ap->a_mutex);
 952 
 953         if (ret != SBP2_SUCCESS) {
 954                 ap->a_state = SBP2_AGENT_STATE_DEAD;
 955                 tp->t_stat.stat_status_dead++;
 956 
 957                 if (task->ts_timeout_id != 0) {
 958                         timeout_id = task->ts_timeout_id;
 959                         task->ts_timeout_id = 0;
 960                         (void) untimeout(timeout_id);
 961                 }
 962                 task->ts_error = SBP2_TASK_ERR_BUS;