Print this page
3752 want more verifiable dbuf user eviction
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Will Andrews <willa@spectralogic.com>

*** 456,467 **** if (dn->dn_dirtyctx_firstset != NULL) { kmem_free(dn->dn_dirtyctx_firstset, 1); dn->dn_dirtyctx_firstset = NULL; } if (dn->dn_bonus != NULL) { mutex_enter(&dn->dn_bonus->db_mtx); ! dbuf_evict(dn->dn_bonus); dn->dn_bonus = NULL; } dn->dn_zio = NULL; dn->dn_have_spill = B_FALSE; --- 456,471 ---- if (dn->dn_dirtyctx_firstset != NULL) { kmem_free(dn->dn_dirtyctx_firstset, 1); dn->dn_dirtyctx_firstset = NULL; } if (dn->dn_bonus != NULL) { + list_t evict_list; + + dmu_buf_create_user_evict_list(&evict_list); mutex_enter(&dn->dn_bonus->db_mtx); ! dbuf_evict(dn->dn_bonus, &evict_list); ! dmu_buf_destroy_user_evict_list(&evict_list); dn->dn_bonus = NULL; } dn->dn_zio = NULL; dn->dn_have_spill = B_FALSE;
*** 955,973 **** DNODE_VERIFY(dn); return (dn); } static void ! dnode_buf_pageout(dmu_buf_t *db, void *arg) { ! dnode_children_t *children_dnodes = arg; int i; - int epb = db->db_size >> DNODE_SHIFT; - - ASSERT(epb == children_dnodes->dnc_count); ! for (i = 0; i < epb; i++) { dnode_handle_t *dnh = &children_dnodes->dnc_children[i]; dnode_t *dn; /* * The dnode handle lock guards against the dnode moving to --- 959,974 ---- DNODE_VERIFY(dn); return (dn); } static void ! dnode_buf_pageout(dmu_buf_user_t *dbu) { ! dnode_children_t *children_dnodes = (dnode_children_t *)dbu; int i; ! for (i = 0; i < children_dnodes->dnc_count; i++) { dnode_handle_t *dnh = &children_dnodes->dnc_children[i]; dnode_t *dn; /* * The dnode handle lock guards against the dnode moving to
*** 993,1003 **** dnode_destroy(dn); /* implicit zrl_remove() */ zrl_destroy(&dnh->dnh_zrlock); dnh->dnh_dnode = NULL; } kmem_free(children_dnodes, sizeof (dnode_children_t) + ! (epb - 1) * sizeof (dnode_handle_t)); } /* * errors: * EINVAL - invalid object number. --- 994,1004 ---- dnode_destroy(dn); /* implicit zrl_remove() */ zrl_destroy(&dnh->dnh_zrlock); dnh->dnh_dnode = NULL; } kmem_free(children_dnodes, sizeof (dnode_children_t) + ! (children_dnodes->dnc_count - 1) * sizeof (dnode_handle_t)); } /* * errors: * EINVAL - invalid object number.
*** 1073,1083 **** epb = db->db.db_size >> DNODE_SHIFT; idx = object & (epb-1); ASSERT(DB_DNODE(db)->dn_type == DMU_OT_DNODE); ! children_dnodes = dmu_buf_get_user(&db->db); if (children_dnodes == NULL) { int i; dnode_children_t *winner; children_dnodes = kmem_alloc(sizeof (dnode_children_t) + (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP); --- 1074,1084 ---- epb = db->db.db_size >> DNODE_SHIFT; idx = object & (epb-1); ASSERT(DB_DNODE(db)->dn_type == DMU_OT_DNODE); ! children_dnodes = (dnode_children_t *)dmu_buf_get_user(&db->db); if (children_dnodes == NULL) { int i; dnode_children_t *winner; children_dnodes = kmem_alloc(sizeof (dnode_children_t) + (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP);
*** 1085,1096 **** dnh = &children_dnodes->dnc_children[0]; for (i = 0; i < epb; i++) { zrl_init(&dnh[i].dnh_zrlock); dnh[i].dnh_dnode = NULL; } ! if (winner = dmu_buf_set_user(&db->db, children_dnodes, NULL, ! dnode_buf_pageout)) { kmem_free(children_dnodes, sizeof (dnode_children_t) + (epb - 1) * sizeof (dnode_handle_t)); children_dnodes = winner; } } --- 1086,1100 ---- dnh = &children_dnodes->dnc_children[0]; for (i = 0; i < epb; i++) { zrl_init(&dnh[i].dnh_zrlock); dnh[i].dnh_dnode = NULL; } ! dmu_buf_init_user(&children_dnodes->db_evict, ! dnode_buf_pageout); ! winner = (dnode_children_t *) ! dmu_buf_set_user(&db->db, &children_dnodes->db_evict); ! if (winner) { kmem_free(children_dnodes, sizeof (dnode_children_t) + (epb - 1) * sizeof (dnode_handle_t)); children_dnodes = winner; } }