MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zil_commit_writer

Function zil_commit_writer

freebsd/contrib/openzfs/module/zfs/zil.c:2453–2489  ·  view source on GitHub ↗

* This function is responsible for ensuring the passed in commit waiter * (and associated commit itx) is committed to an lwb. If the waiter is * not already committed to an lwb, all itxs in the zilog's queue of * itxs will be processed. The assumption is the passed in waiter's * commit itx will found in the queue just like the other non-commit * itxs, such that when the entire queue is proces

Source from the content-addressed store, hash-verified

2451 * the lwb, or the timeout mechanism found in zil_commit_waiter().
2452 */
2453static void
2454zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t *zcw)
2455{
2456 ASSERT(!MUTEX_HELD(&zilog->zl_lock));
2457 ASSERT(spa_writeable(zilog->zl_spa));
2458
2459 mutex_enter(&zilog->zl_issuer_lock);
2460
2461 if (zcw->zcw_lwb != NULL || zcw->zcw_done) {
2462 /*
2463 * It's possible that, while we were waiting to acquire
2464 * the "zl_issuer_lock", another thread committed this
2465 * waiter to an lwb. If that occurs, we bail out early,
2466 * without processing any of the zilog's queue of itxs.
2467 *
2468 * On certain workloads and system configurations, the
2469 * "zl_issuer_lock" can become highly contended. In an
2470 * attempt to reduce this contention, we immediately drop
2471 * the lock if the waiter has already been processed.
2472 *
2473 * We've measured this optimization to reduce CPU spent
2474 * contending on this lock by up to 5%, using a system
2475 * with 32 CPUs, low latency storage (~50 usec writes),
2476 * and 1024 threads performing sync writes.
2477 */
2478 goto out;
2479 }
2480
2481 ZIL_STAT_BUMP(zil_commit_writer_count);
2482
2483 zil_get_commit_list(zilog);
2484 zil_prune_commit_list(zilog);
2485 zil_process_commit_list(zilog);
2486
2487out:
2488 mutex_exit(&zilog->zl_issuer_lock);
2489}
2490
2491static void
2492zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_waiter_t *zcw)

Callers 1

zil_commit_implFunction · 0.85

Calls 6

spa_writeableFunction · 0.85
mutex_enterFunction · 0.85
zil_get_commit_listFunction · 0.85
zil_prune_commit_listFunction · 0.85
zil_process_commit_listFunction · 0.85
mutex_exitFunction · 0.85

Tested by

no test coverage detected