Author: mav
Date: Sat Aug  8 11:22:45 2015
New Revision: 286447
URL: https://svnweb.freebsd.org/changeset/base/286447

Log:
  Don't panic if disk lost TRIM support due to switching to PIO mode.
  
  MFC after:    1 week

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c   Sat Aug  8 10:38:37 2015        (r286446)
+++ head/sys/cam/ata/ata_da.c   Sat Aug  8 11:22:45 2015        (r286447)
@@ -767,10 +767,6 @@ adastrategy(struct bio *bp)
         * Place it in the queue of disk activities for this disk
         */
        if (bp->bio_cmd == BIO_DELETE) {
-               KASSERT((softc->flags & ADA_FLAG_CAN_TRIM) ||
-                       ((softc->flags & ADA_FLAG_CAN_CFA) &&
-                        !(softc->flags & ADA_FLAG_CAN_48BIT)),
-                       ("BIO_DELETE but no supported TRIM method."));
                bioq_disksort(&softc->trim_queue, bp);
        } else {
                if (ADA_SIO)
@@ -1544,7 +1540,14 @@ adastart(struct cam_periph *periph, unio
                            !(softc->flags & ADA_FLAG_CAN_48BIT)) {
                                ada_cfaerase(softc, bp, ataio);
                        } else {
-                               panic("adastart: BIO_DELETE without method, not 
possible.");
+                               /* This can happen if DMA was disabled. */
+                               bioq_remove(&softc->trim_queue, bp);
+                               bp->bio_error = EOPNOTSUPP;
+                               bp->bio_flags |= BIO_ERROR;
+                               biodone(bp);
+                               xpt_release_ccb(start_ccb);
+                               adaschedule(periph);
+                               return;
                        }
                        softc->trim_running = 1;
                        start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to