]> git.proxmox.com Git - mirror_zfs.git/blobdiff - module/zfs/dnode_sync.c
Undo c89 workarounds to match with upstream
[mirror_zfs.git] / module / zfs / dnode_sync.c
index c5ce4b2a2057fc699289b75d011ceea48a6b8bc9..2ec729a6f93a0fc1f8bbb84435f9c9740e7b7b98 100644 (file)
@@ -116,14 +116,10 @@ free_blocks(dnode_t *dn, blkptr_t *bp, int num, dmu_tx_t *tx)
 {
        dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset;
        uint64_t bytesfreed = 0;
-       int i;
 
        dprintf("ds=%p obj=%llx num=%d\n", ds, dn->dn_object, num);
 
-       for (i = 0; i < num; i++, bp++) {
-               uint64_t lsize, lvl;
-               dmu_object_type_t type;
-
+       for (int i = 0; i < num; i++, bp++) {
                if (BP_IS_HOLE(bp))
                        continue;
 
@@ -138,9 +134,9 @@ free_blocks(dnode_t *dn, blkptr_t *bp, int num, dmu_tx_t *tx)
                 * records transmitted during a zfs send.
                 */
 
-               lsize = BP_GET_LSIZE(bp);
-               type = BP_GET_TYPE(bp);
-               lvl = BP_GET_LEVEL(bp);
+               uint64_t lsize = BP_GET_LSIZE(bp);
+               dmu_object_type_t type = BP_GET_TYPE(bp);
+               uint64_t lvl = BP_GET_LEVEL(bp);
 
                bzero(bp, sizeof (blkptr_t));
 
@@ -243,7 +239,6 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks,
        dmu_buf_impl_t *subdb;
        uint64_t start, end, dbstart, dbend;
        unsigned int epbs, shift, i;
-       uint64_t id;
 
        /*
         * There is a small possibility that this block will not be cached:
@@ -280,7 +275,7 @@ free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks,
                FREE_VERIFY(db, start, end, tx);
                free_blocks(dn, bp, end-start+1, tx);
        } else {
-               for (id = start; id <= end; id++, bp++) {
+               for (uint64_t id = start; id <= end; id++, bp++) {
                        if (BP_IS_HOLE(bp))
                                continue;
                        rw_enter(&dn->dn_struct_rwlock, RW_READER);
@@ -356,11 +351,10 @@ dnode_sync_free_range_impl(dnode_t *dn, uint64_t blkid, uint64_t nblks,
                int start = blkid >> shift;
                int end = (blkid + nblks - 1) >> shift;
                dmu_buf_impl_t *db;
-               int i;
 
                ASSERT(start < dn->dn_phys->dn_nblkptr);
                bp += start;
-               for (i = start; i <= end; i++, bp++) {
+               for (int i = start; i <= end; i++, bp++) {
                        if (BP_IS_HOLE(bp))
                                continue;
                        rw_enter(&dn->dn_struct_rwlock, RW_READER);
@@ -562,9 +556,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];
-       boolean_t kill_spill = B_FALSE;
-       boolean_t freeing_dnode;
        ASSERTV(static const dnode_phys_t zerodn = { 0 });
+       boolean_t kill_spill = B_FALSE;
 
        ASSERT(dmu_tx_is_syncing(tx));
        ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg);
@@ -657,7 +650,8 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
                dn->dn_next_bonustype[txgoff] = 0;
        }
 
-       freeing_dnode = dn->dn_free_txg > 0 && dn->dn_free_txg <= tx->tx_txg;
+       boolean_t freeing_dnode = dn->dn_free_txg > 0 &&
+           dn->dn_free_txg <= tx->tx_txg;
 
        /*
         * Remove the spill block if we have been explicitly asked to