Deleted Added
sdiff udiff text old ( 225736 ) new ( 243674 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 4 unchanged lines hidden (view full) ---

13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25#include <sys/zfs_context.h>
26#include <sys/dbuf.h>
27#include <sys/dnode.h>
28#include <sys/dmu.h>
29#include <sys/dmu_tx.h>
30#include <sys/dmu_objset.h>

--- 236 unchanged lines hidden (view full) ---

267 return (all ? ALL : blocks_freed);
268 }
269
270 for (i = start; i <= end; i++, bp++) {
271 if (BP_IS_HOLE(bp))
272 continue;
273 rw_enter(&dn->dn_struct_rwlock, RW_READER);
274 err = dbuf_hold_impl(dn, db->db_level-1, i, TRUE, FTAG, &subdb);
275 ASSERT3U(err, ==, 0);
276 rw_exit(&dn->dn_struct_rwlock);
277
278 if (free_children(subdb, blkid, nblks, trunc, tx) == ALL) {
279 ASSERT3P(subdb->db_blkptr, ==, bp);
280 blocks_freed += free_blocks(dn, bp, 1, tx);
281 } else {
282 all = FALSE;
283 }
284 dbuf_rele(subdb, FTAG);
285 }
286 DB_DNODE_EXIT(db);
287 arc_buf_freeze(db->db_buf);
288#ifdef ZFS_DEBUG
289 bp -= (end-start)+1;
290 for (i = start; i <= end; i++, bp++) {
291 if (i == start && blkid != 0)
292 continue;
293 else if (i == end && !trunc)
294 continue;
295 ASSERT3U(bp->blk_birth, ==, 0);
296 }
297#endif
298 ASSERT(all || blocks_freed == 0 || db->db_last_dirty);
299 return (all ? ALL : blocks_freed);
300}
301
302/*
303 * free_range: Traverse the indicated range of the provided file

--- 39 unchanged lines hidden (view full) ---

343 ASSERT(start < dn->dn_phys->dn_nblkptr);
344 end = (blkid + nblks - 1) >> shift;
345 bp += start;
346 for (i = start; i <= end; i++, bp++) {
347 if (BP_IS_HOLE(bp))
348 continue;
349 rw_enter(&dn->dn_struct_rwlock, RW_READER);
350 err = dbuf_hold_impl(dn, dnlevel-1, i, TRUE, FTAG, &db);
351 ASSERT3U(err, ==, 0);
352 rw_exit(&dn->dn_struct_rwlock);
353
354 if (free_children(db, blkid, nblks, trunc, tx) == ALL) {
355 ASSERT3P(db->db_blkptr, ==, bp);
356 (void) free_blocks(dn, bp, 1, tx);
357 }
358 dbuf_rele(db, FTAG);
359 }

--- 107 unchanged lines hidden (view full) ---

467 int txgoff = tx->tx_txg & TXG_MASK;
468
469 ASSERT(dmu_tx_is_syncing(tx));
470
471 /*
472 * Our contents should have been freed in dnode_sync() by the
473 * free range record inserted by the caller of dnode_free().
474 */
475 ASSERT3U(DN_USED_BYTES(dn->dn_phys), ==, 0);
476 ASSERT(BP_IS_HOLE(dn->dn_phys->dn_blkptr));
477
478 dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]);
479 dnode_evict_dbufs(dn);
480 ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL);
481
482 /*
483 * XXX - It would be nice to assert this, but we may still

--- 108 unchanged lines hidden (view full) ---

592 dnp->dn_bonuslen = 0;
593 else
594 dnp->dn_bonuslen = dn->dn_next_bonuslen[txgoff];
595 ASSERT(dnp->dn_bonuslen <= DN_MAX_BONUSLEN);
596 dn->dn_next_bonuslen[txgoff] = 0;
597 }
598
599 if (dn->dn_next_bonustype[txgoff]) {
600 ASSERT(dn->dn_next_bonustype[txgoff] < DMU_OT_NUMTYPES);
601 dnp->dn_bonustype = dn->dn_next_bonustype[txgoff];
602 dn->dn_next_bonustype[txgoff] = 0;
603 }
604
605 /*
606 * We will either remove a spill block when a file is being removed
607 * or we have been asked to remove it.
608 */

--- 88 unchanged lines hidden ---