Author: imp
Date: Tue Jan 13 00:20:35 2015
New Revision: 277101
URL: https://svnweb.freebsd.org/changeset/base/277101

Log:
  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:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c   Tue Jan 13 00:11:56 2015        (r277100)
+++ head/sys/cam/ata/ata_da.c   Tue Jan 13 00:20:35 2015        (r277101)
@@ -1790,6 +1790,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: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c Tue Jan 13 00:11:56 2015        (r277100)
+++ head/sys/cam/scsi/scsi_da.c Tue Jan 13 00:20:35 2015        (r277101)
@@ -3018,6 +3018,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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to