From 3fa93bb8d3f0c757814b96a98ce3334d132894f1 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 12 Apr 2019 11:30:59 -0700 Subject: [PATCH] Fix TXG_MASK cstyle Fix style issue for 'tx->tx_txg&TXG_MASK'. There should be white space around the '&' character. Split the dnode_reallocate() ASSERT to make it more readable to clearly separate the checks. Reviewed-by: George Melikov Reviewed-by: Tom Caputi Signed-off-by: Brian Behlendorf Closes #8606 --- module/zfs/dbuf.c | 2 +- module/zfs/dmu_recv.c | 2 +- module/zfs/dnode.c | 24 +++++++++++++----------- module/zfs/dsl_dir.c | 6 +++--- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index e6ce2bca5..d52a520fa 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -3959,7 +3959,7 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx) ASSERT(!list_link_active(&dr->dr_dirty_node)); if (dn->dn_object == DMU_META_DNODE_OBJECT) { - list_insert_tail(&dn->dn_dirty_records[txg&TXG_MASK], dr); + list_insert_tail(&dn->dn_dirty_records[txg & TXG_MASK], dr); DB_DNODE_EXIT(db); } else { /* diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c index 0fa3dfad3..6b9404754 100644 --- a/module/zfs/dmu_recv.c +++ b/module/zfs/dmu_recv.c @@ -1280,7 +1280,6 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro, return (err); err = dmu_free_long_object(rwa->os, slot); - if (err != 0) return (err); @@ -1316,6 +1315,7 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro, drro->drr_bonustype, drro->drr_bonuslen, dn_slots << DNODE_SHIFT, tx); } + if (err != 0) { dmu_tx_commit(tx); return (SET_ERROR(EINVAL)); diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 2903bc78d..78a90f68f 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -415,7 +415,7 @@ dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx) ASSERT3U(zfs_refcount_count(&dn->dn_holds), >=, 1); ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); dnode_setdirty(dn, tx); - dn->dn_rm_spillblk[tx->tx_txg&TXG_MASK] = DN_KILL_SPILLBLK; + dn->dn_rm_spillblk[tx->tx_txg & TXG_MASK] = DN_KILL_SPILLBLK; dn->dn_have_spill = B_FALSE; } @@ -690,14 +690,15 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, dnode_setdirty(dn, tx); if (dn->dn_datablksz != blocksize) { /* change blocksize */ - ASSERT(dn->dn_maxblkid == 0 && - (BP_IS_HOLE(&dn->dn_phys->dn_blkptr[0]) || - dnode_block_freed(dn, 0))); + ASSERT0(dn->dn_maxblkid); + ASSERT(BP_IS_HOLE(&dn->dn_phys->dn_blkptr[0]) || + dnode_block_freed(dn, 0)); + dnode_setdblksz(dn, blocksize); - dn->dn_next_blksz[tx->tx_txg&TXG_MASK] = blocksize; + dn->dn_next_blksz[tx->tx_txg & TXG_MASK] = blocksize; } if (dn->dn_bonuslen != bonuslen) - dn->dn_next_bonuslen[tx->tx_txg&TXG_MASK] = bonuslen; + dn->dn_next_bonuslen[tx->tx_txg & TXG_MASK] = bonuslen; if (bonustype == DMU_OT_SA) /* Maximize bonus space for SA */ nblkptr = 1; @@ -706,13 +707,14 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, 1 + ((DN_SLOTS_TO_BONUSLEN(dn_slots) - bonuslen) >> SPA_BLKPTRSHIFT)); if (dn->dn_bonustype != bonustype) - dn->dn_next_bonustype[tx->tx_txg&TXG_MASK] = bonustype; + dn->dn_next_bonustype[tx->tx_txg & TXG_MASK] = bonustype; if (dn->dn_nblkptr != nblkptr) - dn->dn_next_nblkptr[tx->tx_txg&TXG_MASK] = nblkptr; + dn->dn_next_nblkptr[tx->tx_txg & TXG_MASK] = nblkptr; if (dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { dbuf_rm_spill(dn, tx); dnode_rm_spill(dn, tx); } + rw_exit(&dn->dn_struct_rwlock); /* change type */ @@ -1654,9 +1656,9 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) ASSERT(!zfs_refcount_is_zero(&dn->dn_holds) || !avl_is_empty(&dn->dn_dbufs)); ASSERT(dn->dn_datablksz != 0); - ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); - ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); - ASSERT0(dn->dn_next_bonustype[txg&TXG_MASK]); + ASSERT0(dn->dn_next_bonuslen[txg & TXG_MASK]); + ASSERT0(dn->dn_next_blksz[txg & TXG_MASK]); + ASSERT0(dn->dn_next_bonustype[txg & TXG_MASK]); dprintf_ds(os->os_dsl_dataset, "obj=%llu txg=%llu\n", dn->dn_object, txg); diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index b3b677fb8..6fb711f59 100644 --- a/module/zfs/dsl_dir.c +++ b/module/zfs/dsl_dir.c @@ -1168,10 +1168,10 @@ dsl_dir_sync(dsl_dir_t *dd, dmu_tx_t *tx) ASSERT(dmu_tx_is_syncing(tx)); mutex_enter(&dd->dd_lock); - ASSERT0(dd->dd_tempreserved[tx->tx_txg&TXG_MASK]); + ASSERT0(dd->dd_tempreserved[tx->tx_txg & TXG_MASK]); dprintf_dd(dd, "txg=%llu towrite=%lluK\n", tx->tx_txg, - dd->dd_space_towrite[tx->tx_txg&TXG_MASK] / 1024); - dd->dd_space_towrite[tx->tx_txg&TXG_MASK] = 0; + dd->dd_space_towrite[tx->tx_txg & TXG_MASK] / 1024); + dd->dd_space_towrite[tx->tx_txg & TXG_MASK] = 0; mutex_exit(&dd->dd_lock); /* release the hold from dsl_dir_dirty */