1123 return (err);
1124 }
1125
1126 ASSERT3U(db->db.db_size, >=, 1<<DNODE_SHIFT);
1127 epb = db->db.db_size >> DNODE_SHIFT;
1128
1129 idx = object & (epb-1);
1130
1131 ASSERT(DB_DNODE(db)->dn_type == DMU_OT_DNODE);
1132 children_dnodes = dmu_buf_get_user(&db->db);
1133 if (children_dnodes == NULL) {
1134 int i;
1135 dnode_children_t *winner;
1136 children_dnodes = kmem_zalloc(sizeof (dnode_children_t) +
1137 epb * sizeof (dnode_handle_t), KM_SLEEP);
1138 children_dnodes->dnc_count = epb;
1139 dnh = &children_dnodes->dnc_children[0];
1140 for (i = 0; i < epb; i++) {
1141 zrl_init(&dnh[i].dnh_zrlock);
1142 }
1143 dmu_buf_init_user(&children_dnodes->dnc_dbu,
1144 dnode_buf_pageout, NULL);
1145 winner = dmu_buf_set_user(&db->db, &children_dnodes->dnc_dbu);
1146 if (winner != NULL) {
1147
1148 for (i = 0; i < epb; i++) {
1149 zrl_destroy(&dnh[i].dnh_zrlock);
1150 }
1151
1152 kmem_free(children_dnodes, sizeof (dnode_children_t) +
1153 epb * sizeof (dnode_handle_t));
1154 children_dnodes = winner;
1155 }
1156 }
1157 ASSERT(children_dnodes->dnc_count == epb);
1158
1159 dnh = &children_dnodes->dnc_children[idx];
1160 zrl_add(&dnh->dnh_zrlock);
1161 dn = dnh->dnh_dnode;
1162 if (dn == NULL) {
1163 dnode_phys_t *phys = (dnode_phys_t *)db->db.db_data+idx;
|
1123 return (err);
1124 }
1125
1126 ASSERT3U(db->db.db_size, >=, 1<<DNODE_SHIFT);
1127 epb = db->db.db_size >> DNODE_SHIFT;
1128
1129 idx = object & (epb-1);
1130
1131 ASSERT(DB_DNODE(db)->dn_type == DMU_OT_DNODE);
1132 children_dnodes = dmu_buf_get_user(&db->db);
1133 if (children_dnodes == NULL) {
1134 int i;
1135 dnode_children_t *winner;
1136 children_dnodes = kmem_zalloc(sizeof (dnode_children_t) +
1137 epb * sizeof (dnode_handle_t), KM_SLEEP);
1138 children_dnodes->dnc_count = epb;
1139 dnh = &children_dnodes->dnc_children[0];
1140 for (i = 0; i < epb; i++) {
1141 zrl_init(&dnh[i].dnh_zrlock);
1142 }
1143 dmu_buf_init_user(&children_dnodes->dnc_dbu, NULL,
1144 dnode_buf_pageout, NULL);
1145 winner = dmu_buf_set_user(&db->db, &children_dnodes->dnc_dbu);
1146 if (winner != NULL) {
1147
1148 for (i = 0; i < epb; i++) {
1149 zrl_destroy(&dnh[i].dnh_zrlock);
1150 }
1151
1152 kmem_free(children_dnodes, sizeof (dnode_children_t) +
1153 epb * sizeof (dnode_handle_t));
1154 children_dnodes = winner;
1155 }
1156 }
1157 ASSERT(children_dnodes->dnc_count == epb);
1158
1159 dnh = &children_dnodes->dnc_children[idx];
1160 zrl_add(&dnh->dnh_zrlock);
1161 dn = dnh->dnh_dnode;
1162 if (dn == NULL) {
1163 dnode_phys_t *phys = (dnode_phys_t *)db->db.db_data+idx;
|