1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

When aggregating TRIM segments, move the new one to the list 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.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2015-01-11 16:36:39 +00:00
parent eff7715ca7
commit f5b85f6551
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276983

View File

@ -244,17 +244,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);