summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-10-05 07:07:37 +0000
committermav <mav@FreeBSD.org>2015-10-05 07:07:37 +0000
commit7d808295113c5c15e74c86300f1d292526274917 (patch)
tree37456abb99e5d76da64f1036127735709dda5b48
parent47dc3fe5886809cbc91a23da51f3c6fe786211e6 (diff)
downloadFreeBSD-src-7d808295113c5c15e74c86300f1d292526274917.zip
FreeBSD-src-7d808295113c5c15e74c86300f1d292526274917.tar.gz
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.
-rw-r--r--sys/cam/ata/ata_da.c10
-rw-r--r--sys/cam/scsi/scsi_da.c10
2 files changed, 20 insertions, 0 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index ed8eb4d..d924e17 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -1797,6 +1797,16 @@ adadone(struct cam_periph *periph, union ccb *done_ccb)
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);
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 3266301..ac3093c 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -3048,6 +3048,16 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
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);
OpenPOWER on IntegriCloud