| 172 | |
| 173 | #ifdef ZFS_DEBUG |
| 174 | static void |
| 175 | free_verify(dmu_buf_impl_t *db, uint64_t start, uint64_t end, dmu_tx_t *tx) |
| 176 | { |
| 177 | int off, num; |
| 178 | int i, err, epbs; |
| 179 | uint64_t txg = tx->tx_txg; |
| 180 | dnode_t *dn; |
| 181 | |
| 182 | DB_DNODE_ENTER(db); |
| 183 | dn = DB_DNODE(db); |
| 184 | epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; |
| 185 | off = start - (db->db_blkid * 1<<epbs); |
| 186 | num = end - start + 1; |
| 187 | |
| 188 | ASSERT3U(off, >=, 0); |
| 189 | ASSERT3U(num, >=, 0); |
| 190 | ASSERT3U(db->db_level, >, 0); |
| 191 | ASSERT3U(db->db.db_size, ==, 1 << dn->dn_phys->dn_indblkshift); |
| 192 | ASSERT3U(off+num, <=, db->db.db_size >> SPA_BLKPTRSHIFT); |
| 193 | ASSERT(db->db_blkptr != NULL); |
| 194 | |
| 195 | for (i = off; i < off+num; i++) { |
| 196 | uint64_t *buf; |
| 197 | dmu_buf_impl_t *child; |
| 198 | dbuf_dirty_record_t *dr; |
| 199 | int j; |
| 200 | |
| 201 | ASSERT(db->db_level == 1); |
| 202 | |
| 203 | rw_enter(&dn->dn_struct_rwlock, RW_READER); |
| 204 | err = dbuf_hold_impl(dn, db->db_level - 1, |
| 205 | (db->db_blkid << epbs) + i, TRUE, FALSE, FTAG, &child); |
| 206 | rw_exit(&dn->dn_struct_rwlock); |
| 207 | if (err == ENOENT) |
| 208 | continue; |
| 209 | ASSERT(err == 0); |
| 210 | ASSERT(child->db_level == 0); |
| 211 | dr = dbuf_find_dirty_eq(child, txg); |
| 212 | |
| 213 | /* data_old better be zeroed */ |
| 214 | if (dr) { |
| 215 | buf = dr->dt.dl.dr_data->b_data; |
| 216 | for (j = 0; j < child->db.db_size >> 3; j++) { |
| 217 | if (buf[j] != 0) { |
| 218 | panic("freed data not zero: " |
| 219 | "child=%p i=%d off=%d num=%d\n", |
| 220 | (void *)child, i, off, num); |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | /* |
| 226 | * db_data better be zeroed unless it's dirty in a |
| 227 | * future txg. |
| 228 | */ |
| 229 | mutex_enter(&child->db_mtx); |
| 230 | buf = child->db.db_data; |
| 231 | if (buf != NULL && child->db_state != DB_FILL && |
nothing calls this directly
no test coverage detected