Print this page
XXXX introduce drv_sectohz


1431         }
1432 }
1433 
1434 static int
1435 bd_check_state(bd_t *bd, enum dkio_state *state)
1436 {
1437         clock_t         when;
1438 
1439         for (;;) {
1440 
1441                 bd_update_state(bd);
1442 
1443                 mutex_enter(&bd->d_statemutex);
1444 
1445                 if (bd->d_state != *state) {
1446                         *state = bd->d_state;
1447                         mutex_exit(&bd->d_statemutex);
1448                         break;
1449                 }
1450 
1451                 when = drv_usectohz(1000000);
1452                 if (cv_reltimedwait_sig(&bd->d_statecv, &bd->d_statemutex,
1453                     when, TR_CLOCK_TICK) == 0) {
1454                         mutex_exit(&bd->d_statemutex);
1455                         return (EINTR);
1456                 }
1457 
1458                 mutex_exit(&bd->d_statemutex);
1459         }
1460 
1461         return (0);
1462 }
1463 
1464 static int
1465 bd_flush_write_cache_done(struct buf *bp)
1466 {
1467         struct dk_callback *dc = (void *)bp->b_private;
1468 
1469         (*dc->dkc_callback)(dc->dkc_cookie, geterror(bp));
1470         kmem_free(dc, sizeof (*dc));
1471         freerbuf(bp);




1431         }
1432 }
1433 
1434 static int
1435 bd_check_state(bd_t *bd, enum dkio_state *state)
1436 {
1437         clock_t         when;
1438 
1439         for (;;) {
1440 
1441                 bd_update_state(bd);
1442 
1443                 mutex_enter(&bd->d_statemutex);
1444 
1445                 if (bd->d_state != *state) {
1446                         *state = bd->d_state;
1447                         mutex_exit(&bd->d_statemutex);
1448                         break;
1449                 }
1450 
1451                 when = drv_sectohz(1);
1452                 if (cv_reltimedwait_sig(&bd->d_statecv, &bd->d_statemutex,
1453                     when, TR_CLOCK_TICK) == 0) {
1454                         mutex_exit(&bd->d_statemutex);
1455                         return (EINTR);
1456                 }
1457 
1458                 mutex_exit(&bd->d_statemutex);
1459         }
1460 
1461         return (0);
1462 }
1463 
1464 static int
1465 bd_flush_write_cache_done(struct buf *bp)
1466 {
1467         struct dk_callback *dc = (void *)bp->b_private;
1468 
1469         (*dc->dkc_callback)(dc->dkc_cookie, geterror(bp));
1470         kmem_free(dc, sizeof (*dc));
1471         freerbuf(bp);