* 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
| 2451 | * the lwb, or the timeout mechanism found in zil_commit_waiter(). |
| 2452 | */ |
| 2453 | static void |
| 2454 | zil_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 | |
| 2487 | out: |
| 2488 | mutex_exit(&zilog->zl_issuer_lock); |
| 2489 | } |
| 2490 | |
| 2491 | static void |
| 2492 | zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_waiter_t *zcw) |
no test coverage detected