summaryrefslogtreecommitdiffstats
path: root/sys/cam/ata
diff options
context:
space:
mode:
authorsmh <smh@FreeBSD.org>2013-03-29 22:58:15 +0000
committersmh <smh@FreeBSD.org>2013-03-29 22:58:15 +0000
commitfc36a232b91d6ddc6b7d1429049d052764181391 (patch)
treebb7d2f8108f86f3417b00d4bf9c025cf6f66ae71 /sys/cam/ata
parent35fe5219abd995454f3d1279b840072f555159c3 (diff)
downloadFreeBSD-src-fc36a232b91d6ddc6b7d1429049d052764181391.zip
FreeBSD-src-fc36a232b91d6ddc6b7d1429049d052764181391.tar.gz
Adds the ability to enable / disable sorting of BIO requests queued within
CAM. This can significantly improve performance particularly for SSDs which don't suffer from seek latencies. The sysctl / tunable kern.cam.sort_io_queues provides the systems default setting where:- 0 = queued BIOs are NOT sorted 1 = queued BIOs are sorted (default) Each device gets its own sysctl kern.cam.<type>.<id>.sort_io_queue Valid values are:- -1 = use system default (default) 0 = queued BIOs are NOT sorted 1 = queued BIOs are sorted Note: Additional patch will look to add automatic use of none sorted queues for none rotating media e.g. SSD's Reviewed by: scottl Approved by: pjd (mentor) MFC after: 2 weeks
Diffstat (limited to 'sys/cam/ata')
-rw-r--r--sys/cam/ata/ata_da.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index 159091b..1457133 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -130,6 +130,7 @@ struct ada_softc {
ada_state state;
ada_flags flags;
ada_quirks quirks;
+ int sort_io_queue;
int ordered_tag_count;
int outstanding_cmds;
int trim_max_ranges;
@@ -449,6 +450,8 @@ static void adaresume(void *arg);
softc->read_ahead : ada_read_ahead)
#define ADA_WC (softc->write_cache >= 0 ? \
softc->write_cache : ada_write_cache)
+#define ADA_SIO (softc->sort_io_queue >= 0 ? \
+ softc->sort_io_queue : cam_sort_io_queues)
/*
* Most platforms map firmware geometry to actual, but some don't. If
@@ -670,10 +673,17 @@ adastrategy(struct bio *bp)
* Place it in the queue of disk activities for this disk
*/
if (bp->bio_cmd == BIO_DELETE &&
- (softc->flags & ADA_FLAG_CAN_TRIM))
- bioq_disksort(&softc->trim_queue, bp);
- else
- bioq_disksort(&softc->bio_queue, bp);
+ (softc->flags & ADA_FLAG_CAN_TRIM)) {
+ if (ADA_SIO)
+ bioq_disksort(&softc->trim_queue, bp);
+ else
+ bioq_insert_tail(&softc->trim_queue, bp);
+ } else {
+ if (ADA_SIO)
+ bioq_disksort(&softc->bio_queue, bp);
+ else
+ bioq_insert_tail(&softc->bio_queue, bp);
+ }
/*
* Schedule ourselves for performing the work.
@@ -999,6 +1009,10 @@ adasysctlinit(void *context, int pending)
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE,
&softc->write_cache, 0, "Enable disk write cache.");
+ SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+ OID_AUTO, "sort_io_queue", CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &softc->sort_io_queue, 0,
+ "Sort IO queue to try and optimise disk access patterns");
#ifdef ADA_TEST_FAILURE
/*
* Add a 'door bell' sysctl which allows one to set it from userland
@@ -1134,6 +1148,7 @@ adaregister(struct cam_periph *periph, void *arg)
snprintf(announce_buf, sizeof(announce_buf),
"kern.cam.ada.%d.write_cache", periph->unit_number);
TUNABLE_INT_FETCH(announce_buf, &softc->write_cache);
+ softc->sort_io_queue = -1;
adagetparams(periph, cgd);
softc->disk = disk_alloc();
softc->disk->d_devstat = devstat_new_entry(periph->periph_name,
OpenPOWER on IntegriCloud