From df9a441337edd73930490e33888f9bdf7c9a1de7 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sat, 30 Sep 2006 19:45:00 +0900 Subject: [PATCH] --- yaml --- r: 38470 b: refs/heads/master c: 360f654e7cda850034f3f6252a7a7cff3fa77356 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/ata/libata-scsi.c | 12 +++++++++++- trunk/include/linux/libata.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 54d266983341..5c499233fb57 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e5c9e081e9c980fa785cd9002c25a251cf3f090e +refs/heads/master: 360f654e7cda850034f3f6252a7a7cff3fa77356 diff --git a/trunk/drivers/ata/libata-scsi.c b/trunk/drivers/ata/libata-scsi.c index b4a0246506ef..b0d0cc41f3e8 100644 --- a/trunk/drivers/ata/libata-scsi.c +++ b/trunk/drivers/ata/libata-scsi.c @@ -889,6 +889,7 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) { struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev; + unsigned long flags; int max_depth; if (queue_depth < 1) @@ -904,6 +905,14 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) queue_depth = max_depth; scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, queue_depth); + + spin_lock_irqsave(ap->lock, flags); + if (queue_depth > 1) + dev->flags &= ~ATA_DFLAG_NCQ_OFF; + else + dev->flags |= ATA_DFLAG_NCQ_OFF; + spin_unlock_irqrestore(ap->lock, flags); + return queue_depth; } @@ -1293,7 +1302,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm */ goto nothing_to_do; - if ((dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ) { + if ((dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | + ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ) { /* yay, NCQ */ if (!lba_48_ok(block, n_block)) goto out_of_range; diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index e54a5fd6a41e..d1af1dbeaeb4 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -143,6 +143,7 @@ enum { ATA_DFLAG_CFG_MASK = (1 << 8) - 1, ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */ + ATA_DFLAG_NCQ_OFF = (1 << 9), /* devied limited to non-NCQ mode */ ATA_DFLAG_SUSPENDED = (1 << 10), /* device suspended */ ATA_DFLAG_INIT_MASK = (1 << 16) - 1,