kernel: Use bioq_takefirst() in a few more places.
authorSascha Wildner <saw@online.de>
Mon, 23 Jan 2012 13:20:14 +0000 (14:20 +0100)
committerSascha Wildner <saw@online.de>
Mon, 23 Jan 2012 18:16:14 +0000 (19:16 +0100)
sys/bus/cam/scsi/scsi_cd.c
sys/bus/cam/scsi/scsi_pt.c
sys/bus/cam/scsi/scsi_sa.c
sys/dev/disk/md/md.c
sys/dev/disk/mmcsd/mmcsd.c
sys/dev/virtual/cdrom/vcd.c
sys/vfs/mfs/mfs_vfsops.c

index a41e797..03b6f21 100644 (file)
@@ -400,8 +400,7 @@ cdoninvalidate(struct cam_periph *periph)
         * XXX Handle any transactions queued to the card
         *     with XPT_ABORT_CCB.
         */
-       while ((q_bio = bioq_first(&softc->bio_queue)) != NULL){
-               bioq_remove(&softc->bio_queue, q_bio);
+       while ((q_bio = bioq_takefirst(&softc->bio_queue)) != NULL) {
                q_bp = q_bio->bio_buf;
                q_bp->b_resid = q_bp->b_bcount;
                q_bp->b_error = ENXIO;
@@ -1612,8 +1611,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb)
 
                        xpt_print(periph->path,
                                  "cddone: got error %#x back\n", error);
-                       while ((q_bio = bioq_first(&softc->bio_queue)) != NULL) {
-                               bioq_remove(&softc->bio_queue, q_bio);
+                       while ((q_bio = bioq_takefirst(&softc->bio_queue)) != NULL) {
                                q_bp = q_bio->bio_buf;
                                q_bp->b_resid = q_bp->b_bcount;
                                q_bp->b_error = EIO;
index 4d2be67..004b234 100644 (file)
@@ -353,8 +353,7 @@ ptoninvalidate(struct cam_periph *periph)
         * XXX Handle any transactions queued to the card
         *     with XPT_ABORT_CCB.
         */
-       while ((q_bio = bioq_first(&softc->bio_queue)) != NULL){
-               bioq_remove(&softc->bio_queue, q_bio);
+       while ((q_bio = bioq_takefirst(&softc->bio_queue)) != NULL) {
                q_bp = q_bio->bio_buf;
                q_bp->b_resid = q_bp->b_bcount;
                q_bp->b_error = ENXIO;
@@ -552,9 +551,7 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb)
                                 * the client can retry these I/Os in the
                                 * proper order should it attempt to recover.
                                 */
-                               while ((q_bio = bioq_first(&softc->bio_queue))
-                                       != NULL) {
-                                       bioq_remove(&softc->bio_queue, q_bio);
+                               while ((q_bio = bioq_takefirst(&softc->bio_queue)) != NULL) {
                                        q_bp = q_bio->bio_buf;
                                        q_bp->b_resid = q_bp->b_bcount;
                                        q_bp->b_error = EIO;
index 4ffc4ab..d51b27d 100644 (file)
@@ -1384,8 +1384,7 @@ saoninvalidate(struct cam_periph *periph)
         * XXX Handle any transactions queued to the card
         *     with XPT_ABORT_CCB.
         */
-       while ((q_bio = bioq_first(&softc->bio_queue)) != NULL){
-               bioq_remove(&softc->bio_queue, q_bio);
+       while ((q_bio = bioq_takefirst(&softc->bio_queue)) != NULL) {
                q_bp = q_bio->bio_buf;
                q_bp->b_resid = q_bp->b_bcount;
                q_bp->b_error = ENXIO;
@@ -1764,8 +1763,7 @@ sadone(struct cam_periph *periph, union ccb *done_ccb)
                         */
 
                        softc->flags |= SA_FLAG_TAPE_FROZEN;
-                       while ((q_bio = bioq_first(&softc->bio_queue)) != NULL) {
-                               bioq_remove(&softc->bio_queue, q_bio);
+                       while ((q_bio = bioq_takefirst(&softc->bio_queue)) != NULL) {
                                q_bp = q_bio->bio_buf;
                                q_bp->b_resid = q_bp->b_bcount;
                                q_bp->b_error = EIO;
index 1eed7d7..c3f6598 100644 (file)
@@ -359,9 +359,7 @@ mdstrategy_preload(struct dev_strategy_args *ap)
        sc->busy++;
        
        while (1) {
-               bio = bioq_first(&sc->bio_queue);
-               if (bio)
-                       bioq_remove(&sc->bio_queue, bio);
+               bio = bioq_takefirst(&sc->bio_queue);
                crit_exit();
                if (bio == NULL)
                        break;
index b48c9a1..4b7cea1 100644 (file)
@@ -214,8 +214,7 @@ mmcsd_detach(device_t dev)
         *
         * XXX: Return all queued I/O with ENXIO. Is this correct?
         */
-       while ((q_bio = bioq_first(&sc->bio_queue)) != NULL){
-               bioq_remove(&sc->bio_queue, q_bio);
+       while ((q_bio = bioq_takefirst(&sc->bio_queue)) != NULL) {
                q_bp = q_bio->bio_buf;
                q_bp->b_resid = q_bp->b_bcount;
                q_bp->b_error = ENXIO;
index 13c6790..20a1f30 100644 (file)
@@ -30,7 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
  */
 
 /*
@@ -146,8 +145,7 @@ vcdstrategy(struct dev_strategy_args *ap)
        sc = dev->si_drv1;
 
        bioqdisksort(&sc->bio_queue, bio);
-       while ((bio = bioq_first(&sc->bio_queue)) != NULL) {
-               bioq_remove(&sc->bio_queue, bio);
+       while ((bio = bioq_takefirst(&sc->bio_queue)) != NULL) {
                bp = bio->bio_buf;
 
                devstat_start_transaction(&sc->stats);
index 4c95554..eb7b878 100644 (file)
@@ -448,8 +448,7 @@ mfs_start(struct mount *mp, int flags)
        while (mfsp->mfs_active) {
                crit_enter();
 
-               while ((bio = bioq_first(&mfsp->bio_queue)) != NULL) {
-                       bioq_remove(&mfsp->bio_queue, bio);
+               while ((bio = bioq_takefirst(&mfsp->bio_queue)) != NULL) {
                        crit_exit();
                        bp = bio->bio_buf;
                        mfs_doio(bio, mfsp);