Skip to content

Commit 25ea8ce

Browse files
amotinbehlendorf
authored andcommitted
ZIL: Improve next log block size prediction
Track history in context of bursts, not individual log blocks. It allows to not blow away all the history by single large burst of many block, and same time allows optimizations covering multiple blocks in a burst and even predicted following burst. For each burst account its optimal block size and minimal first block size. Use that statistics from the last 8 bursts to predict first block size of the next burst. Remove predefined set of block sizes. Allocate any size we see fit, multiple of 4KB, as required by ZIL now. With compression enabled by default, ZFS already writes pretty random block sizes, so this should not surprise space allocator any more. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #15635
1 parent 8b1a132 commit 25ea8ce

File tree

2 files changed

+201
-74
lines changed

2 files changed

+201
-74
lines changed

include/sys/zil_impl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ typedef struct zil_vdev_node {
182182
} zil_vdev_node_t;
183183

184184
#define ZIL_BURSTS 8
185-
#define ZIL_PREV_BLKS 16
186185

187186
/*
188187
* Stable storage intent log management structure. One per dataset.
@@ -217,15 +216,18 @@ struct zilog {
217216
uint64_t zl_parse_lr_count; /* number of log records parsed */
218217
itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */
219218
list_t zl_itx_commit_list; /* itx list to be committed */
220-
uint64_t zl_cur_used; /* current commit log size used */
219+
uint64_t zl_cur_size; /* current burst full size */
220+
uint64_t zl_cur_left; /* current burst remaining size */
221+
uint64_t zl_cur_max; /* biggest record in current burst */
221222
list_t zl_lwb_list; /* in-flight log write list */
222223
avl_tree_t zl_bp_tree; /* track bps during log parse */
223224
clock_t zl_replay_time; /* lbolt of when replay started */
224225
uint64_t zl_replay_blks; /* number of log blocks replayed */
225226
zil_header_t zl_old_header; /* debugging aid */
226227
uint_t zl_parallel; /* workload is multi-threaded */
227228
uint_t zl_prev_rotor; /* rotor for zl_prev[] */
228-
uint_t zl_prev_blks[ZIL_PREV_BLKS]; /* size - sector rounded */
229+
uint_t zl_prev_opt[ZIL_BURSTS]; /* optimal block size */
230+
uint_t zl_prev_min[ZIL_BURSTS]; /* minimal first block size */
229231
txg_node_t zl_dirty_link; /* protected by dp_dirty_zilogs list */
230232
uint64_t zl_dirty_max_txg; /* highest txg used to dirty zilog */
231233

0 commit comments

Comments
 (0)