Prototype/structure update for Linux
[zfs.git] / module / zfs / dnode_sync.c
index 2ee990a..af636dc 100644 (file)
@@ -328,8 +328,8 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx)
                ASSERT3U(blkid + nblks, <=, dn->dn_phys->dn_nblkptr);
                (void) free_blocks(dn, bp + blkid, nblks, tx);
                if (trunc) {
-                       uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
-                           (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
+                       ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
+                           (dn->dn_phys->dn_datablkszsec<<SPA_MINBLOCKSHIFT));
                        dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
                        ASSERT(off < dn->dn_phys->dn_maxblkid ||
                            dn->dn_phys->dn_maxblkid == 0 ||
@@ -358,8 +358,8 @@ dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx)
                dbuf_rele(db, FTAG);
        }
        if (trunc) {
-               uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
-                   (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT);
+               ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
+                   (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT));
                dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
                ASSERT(off < dn->dn_phys->dn_maxblkid ||
                    dn->dn_phys->dn_maxblkid == 0 ||
@@ -418,9 +418,13 @@ dnode_evict_dbufs(dnode_t *dn)
                if (evicting)
                        delay(1);
                pass++;
-               ASSERT(pass < 100); /* sanity check */
+               if ((pass % 100) == 0)
+                       dprintf("Exceeded %d passes evicting dbufs\n", pass);
        } while (progress);
 
+       if (pass >= 100)
+               dprintf("Required %d passes to evict dbufs\n", pass);
+
        rw_enter(&dn->dn_struct_rwlock, RW_WRITER);
        if (dn->dn_bonus && refcount_is_zero(&dn->dn_bonus->db_holds)) {
                mutex_enter(&dn->dn_bonus->db_mtx);
@@ -435,7 +439,7 @@ dnode_undirty_dbufs(list_t *list)
 {
        dbuf_dirty_record_t *dr;
 
-       while (dr = list_head(list)) {
+       while ((dr = list_head(list))) {
                dmu_buf_impl_t *db = dr->dr_dbuf;
                uint64_t txg = dr->dr_txg;
 
@@ -527,8 +531,8 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
        dnode_phys_t *dnp = dn->dn_phys;
        int txgoff = tx->tx_txg & TXG_MASK;
        list_t *list = &dn->dn_dirty_records[txgoff];
-       static const dnode_phys_t zerodn = { 0 };
        boolean_t kill_spill = B_FALSE;
+       ASSERTV(static const dnode_phys_t zerodn = { 0 });
 
        ASSERT(dmu_tx_is_syncing(tx));
        ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg);
@@ -635,7 +639,7 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
        }
 
        /* process all the "freed" ranges in the file */
-       while (rp = avl_last(&dn->dn_ranges[txgoff])) {
+       while ((rp = avl_last(&dn->dn_ranges[txgoff]))) {
                dnode_sync_free_range(dn, rp->fr_blkid, rp->fr_nblks, tx);
                /* grab the mutex so we don't race with dnode_block_freed() */
                mutex_enter(&dn->dn_mtx);