Date: Thu, 23 Feb 2006 17:24:50 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 92273 for review Message-ID: <200602231724.k1NHOo0p010269@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92273 Change 92273 by jhb@jhb_slimer on 2006/02/23 17:24:25 Use callout_init_mtx(). Now callout_stop() while holding the mutex will definitely stop the callout, so the callout_drain() isn't even needed anymore. Affected files ... .. //depot/projects/smpng/sys/dev/fdc/fdc.c#21 edit Differences ... ==== //depot/projects/smpng/sys/dev/fdc/fdc.c#21 (text+ko) ==== @@ -616,7 +616,7 @@ int once; fd = arg; - mtx_lock(&fd->fdc->fdc_mtx); + mtx_assert(&fd->fdc->fdc_mtx, MA_OWNED); fd->flags &= ~FD_MOTORWAIT; fd->flags |= FD_MOTOR; once = 0; @@ -627,7 +627,6 @@ bioq_disksort(&fd->fdc->head, bp); once = 1; } - mtx_unlock(&fd->fdc->fdc_mtx); if (once) wakeup(&fd->fdc->head); } @@ -646,11 +645,6 @@ fdc->fdout |= (FDO_MOEN0 << fd->fdsu); callout_reset(&fd->toffhandle, hz, fd_turnon, fd); } else { - /* - * We can't call drain from a callout and we can't call it - * while holding a lock needed by the callout being drained, - * so use stop for now. - */ callout_stop(&fd->toffhandle); fd->flags &= ~(FD_MOTOR|FD_MOTORWAIT); fdc->fdout &= ~(FDO_MOEN0 << fd->fdsu); @@ -663,9 +657,8 @@ { struct fd_data *fd = xfd; - mtx_lock(&fd->fdc->fdc_mtx); + mtx_assert(&fd->fdc->fdc_mtx, MA_OWNED); fd_motor(fd, 0); - mtx_unlock(&fd->fdc->fdc_mtx); } /* @@ -1203,7 +1196,6 @@ mtx_lock(&fdc->fdc_mtx); /* If we go from idle, cancel motor turnoff */ if (fd->fd_iocount++ == 0) - /* XXX: Can't drain while holding mutex. */ callout_stop(&fd->toffhandle); if (fd->flags & FD_MOTOR) { /* The motor is on, send it directly to the controller */ @@ -1944,7 +1936,7 @@ fd->fdc = fdc; fd->fdsu = fdsu; fd->options = 0; - callout_init(&fd->toffhandle, 1); + callout_init_mtx(&fd->toffhandle, &fd->fdc->fdc_mtx, 0); /* initialize densities for subdevices */ fdsettype(fd, fd_native_types[fd->type]);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602231724.k1NHOo0p010269>