Author: mav
Date: Mon Oct  5 07:07:37 2015
New Revision: 288694
URL: https://svnweb.freebsd.org/changeset/base/288694

Log:
  MFC r277101 (by imp):
  Explain a bit of tricky code dealing with trims and how it prevents
  starvation. These side effects aren't obvious without extremely
  careful study, and are important to do just so.

Modified:
  stable/10/sys/cam/ata/ata_da.c
  stable/10/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ata/ata_da.c
==============================================================================
--- stable/10/sys/cam/ata/ata_da.c      Mon Oct  5 06:56:22 2015        
(r288693)
+++ stable/10/sys/cam/ata/ata_da.c      Mon Oct  5 07:07:37 2015        
(r288694)
@@ -1797,6 +1797,16 @@ adadone(struct cam_periph *periph, union
 
                        TAILQ_INIT(&queue);
                        TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue);
+                       /*
+                        * Normally, the xpt_release_ccb() above would make sure
+                        * that when we have more work to do, that work would
+                        * get kicked off. However, we specifically keep
+                        * trim_running set to 0 before the call above to allow
+                        * other I/O to progress when many BIO_DELETE requests
+                        * are pushed down. We set trim_running to 0 and call
+                        * daschedule again so that we don't stall if there are
+                        * no other I/Os pending apart from BIO_DELETEs.
+                        */
                        softc->trim_running = 0;
                        adaschedule(periph);
                        cam_periph_unlock(periph);

Modified: stable/10/sys/cam/scsi/scsi_da.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_da.c    Mon Oct  5 06:56:22 2015        
(r288693)
+++ stable/10/sys/cam/scsi/scsi_da.c    Mon Oct  5 07:07:37 2015        
(r288694)
@@ -3048,6 +3048,16 @@ dadone(struct cam_periph *periph, union 
                        TAILQ_INIT(&queue);
                        TAILQ_CONCAT(&queue, &softc->delete_run_queue.queue, 
bio_queue);
                        softc->delete_run_queue.insert_point = NULL;
+                       /*
+                        * Normally, the xpt_release_ccb() above would make sure
+                        * that when we have more work to do, that work would
+                        * get kicked off. However, we specifically keep
+                        * delete_running set to 0 before the call above to
+                        * allow other I/O to progress when many BIO_DELETE
+                        * requests are pushed down. We set delete_running to 0
+                        * and call daschedule again so that we don't stall if
+                        * there are no other I/Os pending apart from 
BIO_DELETEs.
+                        */
                        softc->delete_running = 0;
                        daschedule(periph);
                        cam_periph_unlock(periph);
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to