Deleted Added
full compact
zil.c (321611) zil.c (324205)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1376 unchanged lines hidden (view full) ---

1385 itxs_t *clean_me;
1386
1387 mutex_enter(&itxg->itxg_lock);
1388 if (itxg->itxg_itxs == NULL || itxg->itxg_txg == ZILTEST_TXG) {
1389 mutex_exit(&itxg->itxg_lock);
1390 return;
1391 }
1392 ASSERT3U(itxg->itxg_txg, <=, synced_txg);
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1376 unchanged lines hidden (view full) ---

1385 itxs_t *clean_me;
1386
1387 mutex_enter(&itxg->itxg_lock);
1388 if (itxg->itxg_itxs == NULL || itxg->itxg_txg == ZILTEST_TXG) {
1389 mutex_exit(&itxg->itxg_lock);
1390 return;
1391 }
1392 ASSERT3U(itxg->itxg_txg, <=, synced_txg);
1393 ASSERT(itxg->itxg_txg != 0);
1394 ASSERT(zilog->zl_clean_taskq != NULL);
1393 ASSERT3U(itxg->itxg_txg, !=, 0);
1395 clean_me = itxg->itxg_itxs;
1396 itxg->itxg_itxs = NULL;
1397 itxg->itxg_txg = 0;
1398 mutex_exit(&itxg->itxg_lock);
1399 /*
1400 * Preferably start a task queue to free up the old itxs but
1401 * if taskq_dispatch can't allocate resources to do that then
1402 * free it in-line. This should be rare. Note, using TQ_SLEEP
1403 * created a bad performance problem.
1404 */
1394 clean_me = itxg->itxg_itxs;
1395 itxg->itxg_itxs = NULL;
1396 itxg->itxg_txg = 0;
1397 mutex_exit(&itxg->itxg_lock);
1398 /*
1399 * Preferably start a task queue to free up the old itxs but
1400 * if taskq_dispatch can't allocate resources to do that then
1401 * free it in-line. This should be rare. Note, using TQ_SLEEP
1402 * created a bad performance problem.
1403 */
1405 if (taskq_dispatch(zilog->zl_clean_taskq,
1404 ASSERT3P(zilog->zl_dmu_pool, !=, NULL);
1405 ASSERT3P(zilog->zl_dmu_pool->dp_zil_clean_taskq, !=, NULL);
1406 if (taskq_dispatch(zilog->zl_dmu_pool->dp_zil_clean_taskq,
1406 (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == 0)
1407 zil_itxg_clean(clean_me);
1408}
1409
1410/*
1411 * Get the list of itxs to commit into zl_itx_commit_list.
1412 */
1413static void

--- 137 unchanged lines hidden (view full) ---

1551 * time we call zil_sync().
1552 */
1553 if (txg > spa_last_synced_txg(spa) || txg > spa_freeze_txg(spa))
1554 lwb = zil_lwb_commit(zilog, itx, lwb);
1555 list_remove(&zilog->zl_itx_commit_list, itx);
1556 kmem_free(itx, offsetof(itx_t, itx_lr)
1557 + itx->itx_lr.lrc_reclen);
1558 }
1407 (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == 0)
1408 zil_itxg_clean(clean_me);
1409}
1410
1411/*
1412 * Get the list of itxs to commit into zl_itx_commit_list.
1413 */
1414static void

--- 137 unchanged lines hidden (view full) ---

1552 * time we call zil_sync().
1553 */
1554 if (txg > spa_last_synced_txg(spa) || txg > spa_freeze_txg(spa))
1555 lwb = zil_lwb_commit(zilog, itx, lwb);
1556 list_remove(&zilog->zl_itx_commit_list, itx);
1557 kmem_free(itx, offsetof(itx_t, itx_lr)
1558 + itx->itx_lr.lrc_reclen);
1559 }
1559 DTRACE_PROBE1(zil__cw2, zilog_t *, zilog);
1560
1561 /* write the last block out */
1562 if (lwb != NULL && lwb->lwb_zio != NULL)
1563 lwb = zil_lwb_write_start(zilog, lwb, B_TRUE);
1564
1565 zilog->zl_cur_used = 0;
1566
1567 /*

--- 258 unchanged lines hidden (view full) ---

1826/*
1827 * Open an intent log.
1828 */
1829zilog_t *
1830zil_open(objset_t *os, zil_get_data_t *get_data)
1831{
1832 zilog_t *zilog = dmu_objset_zil(os);
1833
1560
1561 /* write the last block out */
1562 if (lwb != NULL && lwb->lwb_zio != NULL)
1563 lwb = zil_lwb_write_start(zilog, lwb, B_TRUE);
1564
1565 zilog->zl_cur_used = 0;
1566
1567 /*

--- 258 unchanged lines hidden (view full) ---

1826/*
1827 * Open an intent log.
1828 */
1829zilog_t *
1830zil_open(objset_t *os, zil_get_data_t *get_data)
1831{
1832 zilog_t *zilog = dmu_objset_zil(os);
1833
1834 ASSERT(zilog->zl_clean_taskq == NULL);
1835 ASSERT(zilog->zl_get_data == NULL);
1836 ASSERT(list_is_empty(&zilog->zl_lwb_list));
1837
1838 zilog->zl_get_data = get_data;
1834 ASSERT(zilog->zl_get_data == NULL);
1835 ASSERT(list_is_empty(&zilog->zl_lwb_list));
1836
1837 zilog->zl_get_data = get_data;
1839 zilog->zl_clean_taskq = taskq_create("zil_clean", 1, minclsyspri,
1840 2, 2, TASKQ_PREPOPULATE);
1841
1842 return (zilog);
1843}
1844
1845/*
1846 * Close an intent log.
1847 */
1848void

--- 17 unchanged lines hidden (view full) ---

1866 mutex_exit(&zilog->zl_lock);
1867 if (txg)
1868 txg_wait_synced(zilog->zl_dmu_pool, txg);
1869
1870 if (zilog_is_dirty(zilog))
1871 zfs_dbgmsg("zil (%p) is dirty, txg %llu", zilog, txg);
1872 VERIFY(!zilog_is_dirty(zilog));
1873
1838
1839 return (zilog);
1840}
1841
1842/*
1843 * Close an intent log.
1844 */
1845void

--- 17 unchanged lines hidden (view full) ---

1863 mutex_exit(&zilog->zl_lock);
1864 if (txg)
1865 txg_wait_synced(zilog->zl_dmu_pool, txg);
1866
1867 if (zilog_is_dirty(zilog))
1868 zfs_dbgmsg("zil (%p) is dirty, txg %llu", zilog, txg);
1869 VERIFY(!zilog_is_dirty(zilog));
1870
1874 taskq_destroy(zilog->zl_clean_taskq);
1875 zilog->zl_clean_taskq = NULL;
1876 zilog->zl_get_data = NULL;
1877
1878 /*
1879 * We should have only one LWB left on the list; remove it now.
1880 */
1881 mutex_enter(&zilog->zl_lock);
1882 lwb = list_head(&zilog->zl_lwb_list);
1883 if (lwb != NULL) {

--- 315 unchanged lines hidden ---
1871 zilog->zl_get_data = NULL;
1872
1873 /*
1874 * We should have only one LWB left on the list; remove it now.
1875 */
1876 mutex_enter(&zilog->zl_lock);
1877 lwb = list_head(&zilog->zl_lwb_list);
1878 if (lwb != NULL) {

--- 315 unchanged lines hidden ---