mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +03:00
Refactor dnode dirty context from dbuf_dirty
* Add dedicated donde_set_dirtyctx routine. * Add empty dirty record on destroy assertion. * Make much more extensive use of the SET_ERROR macro. Reviewed-by: Will Andrews <wca@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9924
This commit is contained in:
+28
-8
@@ -541,10 +541,7 @@ dnode_destroy(dnode_t *dn)
|
||||
dn->dn_dirty_txg = 0;
|
||||
|
||||
dn->dn_dirtyctx = 0;
|
||||
if (dn->dn_dirtyctx_firstset != NULL) {
|
||||
kmem_free(dn->dn_dirtyctx_firstset, 1);
|
||||
dn->dn_dirtyctx_firstset = NULL;
|
||||
}
|
||||
dn->dn_dirtyctx_firstset = NULL;
|
||||
if (dn->dn_bonus != NULL) {
|
||||
mutex_enter(&dn->dn_bonus->db_mtx);
|
||||
dbuf_destroy(dn->dn_bonus);
|
||||
@@ -649,10 +646,7 @@ dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs,
|
||||
dn->dn_dirtyctx = 0;
|
||||
|
||||
dn->dn_free_txg = 0;
|
||||
if (dn->dn_dirtyctx_firstset) {
|
||||
kmem_free(dn->dn_dirtyctx_firstset, 1);
|
||||
dn->dn_dirtyctx_firstset = NULL;
|
||||
}
|
||||
dn->dn_dirtyctx_firstset = NULL;
|
||||
|
||||
dn->dn_allocated_txg = tx->tx_txg;
|
||||
dn->dn_id_flags = 0;
|
||||
@@ -2007,6 +2001,32 @@ dnode_dirty_l1range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid,
|
||||
mutex_exit(&dn->dn_dbufs_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, void *tag)
|
||||
{
|
||||
/*
|
||||
* Don't set dirtyctx to SYNC if we're just modifying this as we
|
||||
* initialize the objset.
|
||||
*/
|
||||
if (dn->dn_dirtyctx == DN_UNDIRTIED) {
|
||||
dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset;
|
||||
|
||||
if (ds != NULL) {
|
||||
rrw_enter(&ds->ds_bp_rwlock, RW_READER, tag);
|
||||
}
|
||||
if (!BP_IS_HOLE(dn->dn_objset->os_rootbp)) {
|
||||
if (dmu_tx_is_syncing(tx))
|
||||
dn->dn_dirtyctx = DN_DIRTY_SYNC;
|
||||
else
|
||||
dn->dn_dirtyctx = DN_DIRTY_OPEN;
|
||||
dn->dn_dirtyctx_firstset = tag;
|
||||
}
|
||||
if (ds != NULL) {
|
||||
rrw_exit(&ds->ds_bp_rwlock, tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user