summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-01-25 14:31:44 +0000
committermav <mav@FreeBSD.org>2015-01-25 14:31:44 +0000
commite6f27f6344ffc1d62a7587928a496973be38bccb (patch)
treec75a1e401b20cd171732a800fa45c9232b8629cc /sys/cddl
parent35b060644047dd0c6c136101f14d7b52f1b34ca7 (diff)
downloadFreeBSD-src-e6f27f6344ffc1d62a7587928a496973be38bccb.zip
FreeBSD-src-e6f27f6344ffc1d62a7587928a496973be38bccb.tar.gz
MFC r276983: When aggregating TRIM segments, move the new one to the end.
New segment at the list head may block all TRIM requests until txg of that segment can be processed. On my random I/O tests this change reduce peak TRIM list length from 650 to 450 segments. Hopefully it should reduce TRIM burstiness when list processing is unblocked.
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c
index 7a63a43..3eeb57f 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c
@@ -253,17 +253,23 @@ trim_map_segment_add(trim_map_t *tm, uint64_t start, uint64_t end, uint64_t txg)
ts_after->ts_start = ts_before->ts_start;
ts_after->ts_txg = txg;
ts_after->ts_time = time;
+ list_remove(&tm->tm_head, ts_after);
+ list_insert_tail(&tm->tm_head, ts_after);
kmem_free(ts_before, sizeof (*ts_before));
} else if (merge_before) {
TRIM_MAP_SINC(tm, end - ts_before->ts_end);
ts_before->ts_end = end;
ts_before->ts_txg = txg;
ts_before->ts_time = time;
+ list_remove(&tm->tm_head, ts_before);
+ list_insert_tail(&tm->tm_head, ts_before);
} else if (merge_after) {
TRIM_MAP_SINC(tm, ts_after->ts_start - start);
ts_after->ts_start = start;
ts_after->ts_txg = txg;
ts_after->ts_time = time;
+ list_remove(&tm->tm_head, ts_after);
+ list_insert_tail(&tm->tm_head, ts_after);
} else {
TRIM_MAP_SINC(tm, end - start);
TRIM_MAP_QINC(tm);
OpenPOWER on IntegriCloud