MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dnode_block_freed

Function dnode_block_freed

freebsd/contrib/openzfs/module/zfs/dnode.c:2284–2314  ·  view source on GitHub ↗

return TRUE if this blkid was freed in a recent txg, or FALSE if it wasn't */

Source from the content-addressed store, hash-verified

2282
2283/* return TRUE if this blkid was freed in a recent txg, or FALSE if it wasn't */
2284uint64_t
2285dnode_block_freed(dnode_t *dn, uint64_t blkid)
2286{
2287 void *dp = spa_get_dsl(dn->dn_objset->os_spa);
2288 int i;
2289
2290 if (blkid == DMU_BONUS_BLKID)
2291 return (FALSE);
2292
2293 /*
2294 * If we're in the process of opening the pool, dp will not be
2295 * set yet, but there shouldn't be anything dirty.
2296 */
2297 if (dp == NULL)
2298 return (FALSE);
2299
2300 if (dn->dn_free_txg)
2301 return (TRUE);
2302
2303 if (blkid == DMU_SPILL_BLKID)
2304 return (dnode_spill_freed(dn));
2305
2306 mutex_enter(&dn->dn_mtx);
2307 for (i = 0; i < TXG_SIZE; i++) {
2308 if (dn->dn_free_ranges[i] != NULL &&
2309 range_tree_contains(dn->dn_free_ranges[i], blkid, 1))
2310 break;
2311 }
2312 mutex_exit(&dn->dn_mtx);
2313 return (i < TXG_SIZE);
2314}
2315
2316/* call from syncing context when we actually write/free space for this dnode */
2317void

Callers 4

dbuf_read_holeFunction · 0.85
dbuf_prefetch_implFunction · 0.85
dnode_reallocateFunction · 0.85
dmu_syncFunction · 0.85

Calls 5

spa_get_dslFunction · 0.85
dnode_spill_freedFunction · 0.85
mutex_enterFunction · 0.85
range_tree_containsFunction · 0.85
mutex_exitFunction · 0.85

Tested by

no test coverage detected