Deleted Added
full compact
dnode_sync.c (225736) dnode_sync.c (243674)
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 */
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
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
22/*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. 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);
25 */
26
27#include <sys/zfs_context.h>
28#include <sys/dbuf.h>
29#include <sys/dnode.h>
30#include <sys/dmu.h>
31#include <sys/dmu_tx.h>
32#include <sys/dmu_objset.h>

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

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

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

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

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

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

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

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

--- 88 unchanged lines hidden ---