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.
This commit is contained in:
mav 2015-01-25 14:31:44 +00:00
parent 35b0606440
commit e6f27f6344

View File

@ -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);