Print this page
4347 ZPL can use dmu_tx_assign(TXG_WAIT)
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>

*** 1467,1477 **** */ if (end <= zp->z_size) { zfs_range_unlock(rl); return (0); } - top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); if (end > zp->z_blksz && (!ISP2(zp->z_blksz) || zp->z_blksz < zfsvfs->z_max_blksz)) { --- 1467,1476 ----
*** 1487,1504 **** dmu_tx_hold_write(tx, zp->z_id, 0, newblksz); } else { newblksz = 0; } ! error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); dmu_tx_abort(tx); - goto top; - } - dmu_tx_abort(tx); zfs_range_unlock(rl); return (error); } if (newblksz) --- 1486,1498 ---- dmu_tx_hold_write(tx, zp->z_id, 0, newblksz); } else { newblksz = 0; } ! error = dmu_tx_assign(tx, TXG_WAIT); if (error) { dmu_tx_abort(tx); zfs_range_unlock(rl); return (error); } if (newblksz)
*** 1590,1611 **** error = dmu_free_long_range(zfsvfs->z_os, zp->z_id, end, -1); if (error) { zfs_range_unlock(rl); return (error); } - top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); ! error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); dmu_tx_abort(tx); - goto top; - } - dmu_tx_abort(tx); zfs_range_unlock(rl); return (error); } zp->z_size = end; --- 1584,1599 ---- error = dmu_free_long_range(zfsvfs->z_os, zp->z_id, end, -1); if (error) { zfs_range_unlock(rl); return (error); } tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); ! error = dmu_tx_assign(tx, TXG_WAIT); if (error) { dmu_tx_abort(tx); zfs_range_unlock(rl); return (error); } zp->z_size = end;
*** 1707,1724 **** return (error); log: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); ! error = dmu_tx_assign(tx, TXG_NOWAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); dmu_tx_abort(tx); - goto log; - } - dmu_tx_abort(tx); return (error); } SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, mtime, 16); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, ctime, 16); --- 1695,1707 ---- return (error); log: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); ! error = dmu_tx_assign(tx, TXG_WAIT); if (error) { dmu_tx_abort(tx); return (error); } SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, mtime, 16); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, ctime, 16);