1317
1318 ASSERT(txg != 0);
1319 ASSERT(db->db_blkid != DMU_BONUS_BLKID);
1320 ASSERT0(db->db_level);
1321 ASSERT(MUTEX_HELD(&db->db_mtx));
1322
1323 /*
1324 * If this buffer is not dirty, we're done.
1325 */
1326 for (drp = &db->db_last_dirty; (dr = *drp) != NULL; drp = &dr->dr_next)
1327 if (dr->dr_txg <= txg)
1328 break;
1329 if (dr == NULL || dr->dr_txg < txg)
1330 return (B_FALSE);
1331 ASSERT(dr->dr_txg == txg);
1332 ASSERT(dr->dr_dbuf == db);
1333
1334 DB_DNODE_ENTER(db);
1335 dn = DB_DNODE(db);
1336
1337 /*
1338 * Note: This code will probably work even if there are concurrent
1339 * holders, but it is untested in that scenerio, as the ZPL and
1340 * ztest have additional locking (the range locks) that prevents
1341 * that type of concurrent access.
1342 */
1343 ASSERT3U(refcount_count(&db->db_holds), ==, db->db_dirtycnt);
1344
1345 dprintf_dbuf(db, "size=%llx\n", (u_longlong_t)db->db.db_size);
1346
1347 ASSERT(db->db.db_size != 0);
1348
1349 /*
1350 * Any space we accounted for in dp_dirty_* will be cleaned up by
1351 * dsl_pool_sync(). This is relatively rare so the discrepancy
1352 * is not a big deal.
1353 */
1354
1355 *drp = dr->dr_next;
1356
1357 /*
1358 * Note that there are three places in dbuf_dirty()
1359 * where this dirty record may be put on a list.
1360 * Make sure to do a list_remove corresponding to
1361 * every one of those list_insert calls.
1362 */
1363 if (dr->dr_parent) {
1364 mutex_enter(&dr->dr_parent->dt.di.dr_mtx);
|
1317
1318 ASSERT(txg != 0);
1319 ASSERT(db->db_blkid != DMU_BONUS_BLKID);
1320 ASSERT0(db->db_level);
1321 ASSERT(MUTEX_HELD(&db->db_mtx));
1322
1323 /*
1324 * If this buffer is not dirty, we're done.
1325 */
1326 for (drp = &db->db_last_dirty; (dr = *drp) != NULL; drp = &dr->dr_next)
1327 if (dr->dr_txg <= txg)
1328 break;
1329 if (dr == NULL || dr->dr_txg < txg)
1330 return (B_FALSE);
1331 ASSERT(dr->dr_txg == txg);
1332 ASSERT(dr->dr_dbuf == db);
1333
1334 DB_DNODE_ENTER(db);
1335 dn = DB_DNODE(db);
1336
1337 dprintf_dbuf(db, "size=%llx\n", (u_longlong_t)db->db.db_size);
1338
1339 ASSERT(db->db.db_size != 0);
1340
1341 /*
1342 * Any space we accounted for in dp_dirty_* will be cleaned up by
1343 * dsl_pool_sync(). This is relatively rare so the discrepancy
1344 * is not a big deal.
1345 */
1346
1347 *drp = dr->dr_next;
1348
1349 /*
1350 * Note that there are three places in dbuf_dirty()
1351 * where this dirty record may be put on a list.
1352 * Make sure to do a list_remove corresponding to
1353 * every one of those list_insert calls.
1354 */
1355 if (dr->dr_parent) {
1356 mutex_enter(&dr->dr_parent->dt.di.dr_mtx);
|