From a3c9d3d8c02c5c98212731ebed28888fa4a81f08 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 10 Apr 2011 09:00:52 -0700 Subject: [PATCH] kernel - Fix degenerate condition for ahci/cam disks without tags * Fix a calculation that resolve to a value of at least 1, but was resolving to a value of 0 for USB sticks and other disk devices which do not negotiate NCQ. Reported-by: Matthias Rampke , swildner, others --- sys/bus/cam/scsi/scsi_da.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/bus/cam/scsi/scsi_da.c b/sys/bus/cam/scsi/scsi_da.c index 86e2b65e64..48e3c7340e 100644 --- a/sys/bus/cam/scsi/scsi_da.c +++ b/sys/bus/cam/scsi/scsi_da.c @@ -1215,12 +1215,12 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) * and prevent any writes from draining, even if the HD's * cache is not full. */ - limit = (periph->sim->max_tagged_dev_openings + 1) * 2 / 3; + limit = periph->sim->max_tagged_dev_openings * 2 / 3 + 1; #if 0 /* DEBUGGING */ static int savets; static long savets2; - if (time_second != savets2 || (ticks != savets && (softc->outstanding_cmds_rd || softc->outstanding_cmds_wr))) { + if (1 || time_second != savets2 || (ticks != savets && (softc->outstanding_cmds_rd || softc->outstanding_cmds_wr))) { kprintf("%d %d (%d)\n", softc->outstanding_cmds_rd, softc->outstanding_cmds_wr, -- 2.41.0