]> granicus.if.org Git - zfs/commitdiff
Linux 4.19-rc3+ compat: Remove refcount_t compat
authorTim Schumacher <timschumi@gmx.de>
Wed, 26 Sep 2018 17:29:26 +0000 (19:29 +0200)
committerTony Hutter <hutter2@llnl.gov>
Thu, 8 Nov 2018 22:38:28 +0000 (14:38 -0800)
torvalds/linux@59b57717f ("blkcg: delay blkg destruction until
after writeback has finished") added a refcount_t to the blkcg
structure. Due to the refcount_t compatibility code, zfs_refcount_t
was used by mistake.

Resolve this by removing the compatibility code and replacing the
occurrences of refcount_t with zfs_refcount_t.

Reviewed-by: Franz Pletz <fpletz@fnordicwalking.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Closes #7885
Closes #7932

29 files changed:
cmd/ztest/ztest.c
include/linux/vfs_compat.h
include/sys/abd.h
include/sys/arc.h
include/sys/arc_impl.h
include/sys/dbuf.h
include/sys/dmu_tx.h
include/sys/dnode.h
include/sys/dsl_dataset.h
include/sys/metaslab_impl.h
include/sys/refcount.h
include/sys/rrwlock.h
include/sys/sa_impl.h
include/sys/spa_impl.h
include/sys/zap.h
include/sys/zfs_znode.h
module/zfs/arc.c
module/zfs/dbuf.c
module/zfs/dmu.c
module/zfs/dmu_tx.c
module/zfs/dnode.c
module/zfs/dsl_dataset.c
module/zfs/metaslab.c
module/zfs/refcount.c
module/zfs/rrwlock.c
module/zfs/sa.c
module/zfs/spa_misc.c
module/zfs/zfs_ctldir.c
module/zfs/zfs_znode.c

index a410eeefbabc14f863467e6a45925dcb21cd1f3e..24967a768e09624d4be63d0ba8a8e17c1eb18a79 100644 (file)
@@ -1189,7 +1189,7 @@ ztest_spa_prop_set_uint64(zpool_prop_t prop, uint64_t value)
  */
 typedef struct {
        list_node_t z_lnode;
-       refcount_t z_refcnt;
+       zfs_refcount_t z_refcnt;
        uint64_t z_object;
        zfs_rlock_t z_range_lock;
 } ztest_znode_t;
@@ -1248,13 +1248,13 @@ ztest_znode_get(ztest_ds_t *zd, uint64_t object)
        for (zp = list_head(&zll->z_list); (zp);
            zp = list_next(&zll->z_list, zp)) {
                if (zp->z_object == object) {
-                       refcount_add(&zp->z_refcnt, RL_TAG);
+                       zfs_refcount_add(&zp->z_refcnt, RL_TAG);
                        break;
                }
        }
        if (zp == NULL) {
                zp = ztest_znode_init(object);
-               refcount_add(&zp->z_refcnt, RL_TAG);
+               zfs_refcount_add(&zp->z_refcnt, RL_TAG);
                list_insert_head(&zll->z_list, zp);
        }
        mutex_exit(&zll->z_lock);
index 90b3cca78c08da9855b65c70502e6d15f869a9b9..c01f5850881e8c522ca2d400f20fd16fca7abd0b 100644 (file)
@@ -297,9 +297,6 @@ lseek_execute(
  * This is several orders of magnitude larger than expected grace period.
  * At 60 seconds the kernel will also begin issuing RCU stall warnings.
  */
-#ifdef refcount_t
-#undef refcount_t
-#endif
 
 #include <linux/posix_acl.h>
 
@@ -430,8 +427,6 @@ typedef mode_t zpl_equivmode_t;
 #define        zpl_posix_acl_valid(ip, acl)  posix_acl_valid(acl)
 #endif
 
-#define        refcount_t      zfs_refcount_t
-
 #endif /* CONFIG_FS_POSIX_ACL */
 
 /*
index cd7105013705e2eb9c2b547541a41db2c0a0367a..4898606a3f4028ffee5f3c44a7446e1c1b79cdf9 100644 (file)
@@ -52,7 +52,7 @@ typedef struct abd {
        abd_flags_t     abd_flags;
        uint_t          abd_size;       /* excludes scattered abd_offset */
        struct abd      *abd_parent;
-       refcount_t      abd_children;
+       zfs_refcount_t  abd_children;
        union {
                struct abd_scatter {
                        uint_t          abd_offset;
index 1ea4937bd451c997cbd72984cf0f791755f0d903..943ebfb5b3a3969118f31acb0c6f45cafccfec4e 100644 (file)
@@ -76,7 +76,7 @@ struct arc_prune {
        void                    *p_private;
        uint64_t                p_adjust;
        list_node_t             p_node;
-       refcount_t              p_refcnt;
+       zfs_refcount_t          p_refcnt;
 };
 
 typedef enum arc_strategy {
index c6363f2ab71a8bc9ea3054ec3e32b09cced19189..ed2b0abe2051bdef7c45d7bffa8410155fc3e322 100644 (file)
@@ -74,12 +74,12 @@ typedef struct arc_state {
        /*
         * total amount of evictable data in this state
         */
-       refcount_t arcs_esize[ARC_BUFC_NUMTYPES];
+       zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES];
        /*
         * total amount of data in this state; this includes: evictable,
         * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA.
         */
-       refcount_t arcs_size;
+       zfs_refcount_t arcs_size;
        /*
         * supports the "dbufs" kstat
         */
@@ -163,7 +163,7 @@ typedef struct l1arc_buf_hdr {
        uint32_t                b_l2_hits;
 
        /* self protecting */
-       refcount_t              b_refcnt;
+       zfs_refcount_t          b_refcnt;
 
        arc_callback_t          *b_acb;
        abd_t                   *b_pabd;
@@ -180,7 +180,7 @@ typedef struct l2arc_dev {
        kmutex_t                l2ad_mtx;       /* lock for buffer list */
        list_t                  l2ad_buflist;   /* buffer list */
        list_node_t             l2ad_node;      /* device list node */
-       refcount_t              l2ad_alloc;     /* allocated bytes */
+       zfs_refcount_t          l2ad_alloc;     /* allocated bytes */
 } l2arc_dev_t;
 
 typedef struct l2arc_buf_hdr {
index f3f2007d51736660d981590e1941fdd2cdc2925d..127acad33c71ad632d56a646a7e04e8f9c71596f 100644 (file)
@@ -212,7 +212,7 @@ typedef struct dmu_buf_impl {
         * If nonzero, the buffer can't be destroyed.
         * Protected by db_mtx.
         */
-       refcount_t db_holds;
+       zfs_refcount_t db_holds;
 
        /* buffer holding our data */
        arc_buf_t *db_buf;
index 74b7e1116382696c6582a83302667eba6718bd09..96bbcb0545b7b1f91adedd1125903db7b3a8a248 100644 (file)
@@ -97,8 +97,8 @@ typedef struct dmu_tx_hold {
        dmu_tx_t *txh_tx;
        list_node_t txh_node;
        struct dnode *txh_dnode;
-       refcount_t txh_space_towrite;
-       refcount_t txh_memory_tohold;
+       zfs_refcount_t txh_space_towrite;
+       zfs_refcount_t txh_memory_tohold;
        enum dmu_tx_hold_type txh_type;
        uint64_t txh_arg1;
        uint64_t txh_arg2;
index 2dd087b3e859d94e1aeebad2e6db88b1a7921446..1e77e0a32ec4d3886223accc644df8585a79105e 100644 (file)
@@ -266,8 +266,8 @@ struct dnode {
        uint8_t *dn_dirtyctx_firstset;          /* dbg: contents meaningless */
 
        /* protected by own devices */
-       refcount_t dn_tx_holds;
-       refcount_t dn_holds;
+       zfs_refcount_t dn_tx_holds;
+       zfs_refcount_t dn_holds;
 
        kmutex_t dn_dbufs_mtx;
        /*
index 1281674bbec23e418835859536eba378dff8c92c..d96f526dbfd6811fe680a6b56de86a8997d38473 100644 (file)
@@ -186,7 +186,7 @@ typedef struct dsl_dataset {
         * Owning counts as a long hold.  See the comments above
         * dsl_pool_hold() for details.
         */
-       refcount_t ds_longholds;
+       zfs_refcount_t ds_longholds;
 
        /* no locking; only for making guesses */
        uint64_t ds_trysnap_txg;
index f8a713a4f1ffa09418ad213e9325439327d6d645..601519378a1146f81727268e31c42c40a5d987e7 100644 (file)
@@ -179,8 +179,7 @@ struct metaslab_class {
         * number of allocations allowed.
         */
        uint64_t                mc_alloc_max_slots;
-       refcount_t              mc_alloc_slots;
-
+       zfs_refcount_t          mc_alloc_slots;
        uint64_t                mc_alloc_groups; /* # of allocatable groups */
 
        uint64_t                mc_alloc;       /* total allocated space */
@@ -230,7 +229,7 @@ struct metaslab_group {
         * are unable to handle their share of allocations.
         */
        uint64_t                mg_max_alloc_queue_depth;
-       refcount_t              mg_alloc_queue_depth;
+       zfs_refcount_t          mg_alloc_queue_depth;
 
        /*
         * A metalab group that can no longer allocate the minimum block
index a96220b29ad05974e49f5a622e42c64810f824fb..5c5198d82cc55c2ad731ce7dda3f032608e12856 100644 (file)
@@ -41,17 +41,6 @@ extern "C" {
  */
 #define        FTAG ((char *)__func__)
 
-/*
- * Starting with 4.11, torvalds/linux@f405df5, the linux kernel defines a
- * refcount_t type of its own.  The macro below effectively changes references
- * in the ZFS code from refcount_t to zfs_refcount_t at compile time, so that
- * existing code need not be altered, reducing conflicts when landing openZFS
- * patches.
- */
-
-#define        refcount_t      zfs_refcount_t
-#define        refcount_add    zfs_refcount_add
-
 #ifdef ZFS_DEBUG
 typedef struct reference {
        list_node_t ref_link;
@@ -69,23 +58,28 @@ typedef struct refcount {
        uint64_t rc_removed_count;
 } zfs_refcount_t;
 
-/* Note: refcount_t must be initialized with refcount_create[_untracked]() */
-
-void refcount_create(refcount_t *rc);
-void refcount_create_untracked(refcount_t *rc);
-void refcount_create_tracked(refcount_t *rc);
-void refcount_destroy(refcount_t *rc);
-void refcount_destroy_many(refcount_t *rc, uint64_t number);
-int refcount_is_zero(refcount_t *rc);
-int64_t refcount_count(refcount_t *rc);
-int64_t zfs_refcount_add(refcount_t *rc, void *holder_tag);
-int64_t refcount_remove(refcount_t *rc, void *holder_tag);
-int64_t refcount_add_many(refcount_t *rc, uint64_t number, void *holder_tag);
-int64_t refcount_remove_many(refcount_t *rc, uint64_t number, void *holder_tag);
-void refcount_transfer(refcount_t *dst, refcount_t *src);
-void refcount_transfer_ownership(refcount_t *, void *, void *);
-boolean_t refcount_held(refcount_t *, void *);
-boolean_t refcount_not_held(refcount_t *, void *);
+/*
+ * Note: zfs_refcount_t must be initialized with
+ * refcount_create[_untracked]()
+ */
+
+void refcount_create(zfs_refcount_t *rc);
+void refcount_create_untracked(zfs_refcount_t *rc);
+void refcount_create_tracked(zfs_refcount_t *rc);
+void refcount_destroy(zfs_refcount_t *rc);
+void refcount_destroy_many(zfs_refcount_t *rc, uint64_t number);
+int refcount_is_zero(zfs_refcount_t *rc);
+int64_t refcount_count(zfs_refcount_t *rc);
+int64_t zfs_refcount_add(zfs_refcount_t *rc, void *holder_tag);
+int64_t refcount_remove(zfs_refcount_t *rc, void *holder_tag);
+int64_t refcount_add_many(zfs_refcount_t *rc, uint64_t number,
+    void *holder_tag);
+int64_t refcount_remove_many(zfs_refcount_t *rc, uint64_t number,
+    void *holder_tag);
+void refcount_transfer(zfs_refcount_t *dst, zfs_refcount_t *src);
+void refcount_transfer_ownership(zfs_refcount_t *, void *, void *);
+boolean_t refcount_held(zfs_refcount_t *, void *);
+boolean_t refcount_not_held(zfs_refcount_t *, void *);
 
 void refcount_init(void);
 void refcount_fini(void);
@@ -94,7 +88,7 @@ void refcount_fini(void);
 
 typedef struct refcount {
        uint64_t rc_count;
-} refcount_t;
+} zfs_refcount_t;
 
 #define        refcount_create(rc) ((rc)->rc_count = 0)
 #define        refcount_create_untracked(rc) ((rc)->rc_count = 0)
index 7a328fd680305bd0689977a066aac700da91b024..e1c1756cf29abdee8d84a89fc28b7dc9fa4423ea 100644 (file)
@@ -57,8 +57,8 @@ typedef struct rrwlock {
        kmutex_t        rr_lock;
        kcondvar_t      rr_cv;
        kthread_t       *rr_writer;
-       refcount_t      rr_anon_rcount;
-       refcount_t      rr_linked_rcount;
+       zfs_refcount_t  rr_anon_rcount;
+       zfs_refcount_t  rr_linked_rcount;
        boolean_t       rr_writer_wanted;
        boolean_t       rr_track_all;
 } rrwlock_t;
index b68b7610b25e2d82962807fa33923c72791badda..7eddd8750faac1343826e575afddb679895a79b4 100644 (file)
@@ -110,7 +110,7 @@ typedef struct sa_idx_tab {
        list_node_t     sa_next;
        sa_lot_t        *sa_layout;
        uint16_t        *sa_variable_lengths;
-       refcount_t      sa_refcount;
+       zfs_refcount_t  sa_refcount;
        uint32_t        *sa_idx_tab;    /* array of offsets */
 } sa_idx_tab_t;
 
index fa7490ace673831a41e323b2fdd0722ef3f9da81..62ac8f67c1faab4baa81f07a30b321849f0149f0 100644 (file)
@@ -78,7 +78,7 @@ typedef struct spa_config_lock {
        kthread_t       *scl_writer;
        int             scl_write_wanted;
        kcondvar_t      scl_cv;
-       refcount_t      scl_count;
+       zfs_refcount_t  scl_count;
 } spa_config_lock_t;
 
 typedef struct spa_config_dirent {
@@ -281,12 +281,12 @@ struct spa {
 
        /*
         * spa_refcount & spa_config_lock must be the last elements
-        * because refcount_t changes size based on compilation options.
+        * because zfs_refcount_t changes size based on compilation options.
         * In order for the MDB module to function correctly, the other
         * fields must remain in the same location.
         */
        spa_config_lock_t spa_config_lock[SCL_LOCKS]; /* config changes */
-       refcount_t      spa_refcount;           /* number of opens */
+       zfs_refcount_t  spa_refcount;           /* number of opens */
 
        taskq_t         *spa_upgrade_taskq;     /* taskq for upgrade jobs */
 };
index 43b7fbd263c26ebe8af1597d05e7d06abb6a96f5..7acc3becb5a19704e9a3b8675f9a293d934e949d 100644 (file)
@@ -226,7 +226,7 @@ int zap_lookup_norm_by_dnode(dnode_t *dn, const char *name,
     boolean_t *ncp);
 
 int zap_count_write_by_dnode(dnode_t *dn, const char *name,
-    int add, refcount_t *towrite, refcount_t *tooverwrite);
+    int add, zfs_refcount_t *towrite, zfs_refcount_t *tooverwrite);
 
 /*
  * Create an attribute with the given name and value.
index 26d1eb37557c5311f911f83bc25202183d69fe94..33bc20d11566a530cb1f28f97b51235b76bd0621 100644 (file)
@@ -209,7 +209,7 @@ typedef struct znode_hold {
        uint64_t        zh_obj;         /* object id */
        kmutex_t        zh_lock;        /* lock serializing object access */
        avl_node_t      zh_node;        /* avl tree linkage */
-       refcount_t      zh_refcount;    /* active consumer reference count */
+       zfs_refcount_t  zh_refcount;    /* active consumer reference count */
 } znode_hold_t;
 
 /*
index bcf74dd6ea45fc82f78175e268cfb80cc2077ab7..7518d5c86756f925db9d1c6ae88f6f1cb5c3149e 100644 (file)
@@ -1966,7 +1966,7 @@ add_reference(arc_buf_hdr_t *hdr, void *tag)
 
        state = hdr->b_l1hdr.b_state;
 
-       if ((refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) &&
+       if ((zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) &&
            (state != arc_anon)) {
                /* We don't use the L2-only state list. */
                if (state != arc_l2c_only) {
@@ -2505,7 +2505,7 @@ arc_return_buf(arc_buf_t *buf, void *tag)
 
        ASSERT3P(buf->b_data, !=, NULL);
        ASSERT(HDR_HAS_L1HDR(hdr));
-       (void) refcount_add(&hdr->b_l1hdr.b_refcnt, tag);
+       (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag);
        (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag);
 
        arc_loaned_bytes_update(-arc_buf_size(buf));
@@ -2519,7 +2519,7 @@ arc_loan_inuse_buf(arc_buf_t *buf, void *tag)
 
        ASSERT3P(buf->b_data, !=, NULL);
        ASSERT(HDR_HAS_L1HDR(hdr));
-       (void) refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag);
+       (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag);
        (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, tag);
 
        arc_loaned_bytes_update(arc_buf_size(buf));
@@ -3533,7 +3533,7 @@ arc_prune_async(int64_t adjust)
                if (refcount_count(&ap->p_refcnt) >= 2)
                        continue;
 
-               refcount_add(&ap->p_refcnt, ap->p_pfunc);
+               zfs_refcount_add(&ap->p_refcnt, ap->p_pfunc);
                ap->p_adjust = adjust;
                if (taskq_dispatch(arc_prune_taskq, arc_prune_task,
                    ap, TQ_SLEEP) == TASKQID_INVALID) {
@@ -5549,7 +5549,7 @@ arc_add_prune_callback(arc_prune_func_t *func, void *private)
        refcount_create(&p->p_refcnt);
 
        mutex_enter(&arc_prune_mtx);
-       refcount_add(&p->p_refcnt, &arc_prune_list);
+       zfs_refcount_add(&p->p_refcnt, &arc_prune_list);
        list_insert_head(&arc_prune_list, p);
        mutex_exit(&arc_prune_mtx);
 
@@ -5815,7 +5815,7 @@ arc_release(arc_buf_t *buf, void *tag)
                nhdr->b_l1hdr.b_mfu_hits = 0;
                nhdr->b_l1hdr.b_mfu_ghost_hits = 0;
                nhdr->b_l1hdr.b_l2_hits = 0;
-               (void) refcount_add(&nhdr->b_l1hdr.b_refcnt, tag);
+               (void) zfs_refcount_add(&nhdr->b_l1hdr.b_refcnt, tag);
                buf->b_hdr = nhdr;
 
                mutex_exit(&buf->b_evict_lock);
index 6edb39d6d0541800cfe185e35e23271bca690270..5101c848b505aac90965dbbdda9a5b795e2818e1 100644 (file)
@@ -104,7 +104,7 @@ static boolean_t dbuf_evict_thread_exit;
  * become eligible for arc eviction.
  */
 static multilist_t *dbuf_cache;
-static refcount_t dbuf_cache_size;
+static zfs_refcount_t dbuf_cache_size;
 unsigned long  dbuf_cache_max_bytes = 100 * 1024 * 1024;
 
 /* Cap the size of the dbuf cache to log2 fraction of arc size. */
@@ -2384,7 +2384,7 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid,
 
        ASSERT(dn->dn_object == DMU_META_DNODE_OBJECT ||
            refcount_count(&dn->dn_holds) > 0);
-       (void) refcount_add(&dn->dn_holds, db);
+       (void) zfs_refcount_add(&dn->dn_holds, db);
        atomic_inc_32(&dn->dn_dbufs_count);
 
        dprintf_dbuf(db, "db=%p\n", db);
@@ -2749,7 +2749,7 @@ __dbuf_hold_impl(struct dbuf_hold_impl_data *dh)
                (void) refcount_remove_many(&dbuf_cache_size,
                    dh->dh_db->db.db_size, dh->dh_db);
        }
-       (void) refcount_add(&dh->dh_db->db_holds, dh->dh_tag);
+       (void) zfs_refcount_add(&dh->dh_db->db_holds, dh->dh_tag);
        DBUF_VERIFY(dh->dh_db);
        mutex_exit(&dh->dh_db->db_mtx);
 
@@ -2873,7 +2873,7 @@ dbuf_rm_spill(dnode_t *dn, dmu_tx_t *tx)
 void
 dbuf_add_ref(dmu_buf_impl_t *db, void *tag)
 {
-       int64_t holds = refcount_add(&db->db_holds, tag);
+       int64_t holds = zfs_refcount_add(&db->db_holds, tag);
        VERIFY3S(holds, >, 1);
 }
 
@@ -2893,7 +2893,7 @@ dbuf_try_add_ref(dmu_buf_t *db_fake, objset_t *os, uint64_t obj, uint64_t blkid,
 
        if (found_db != NULL) {
                if (db == found_db && dbuf_refcount(db) > db->db_dirtycnt) {
-                       (void) refcount_add(&db->db_holds, tag);
+                       (void) zfs_refcount_add(&db->db_holds, tag);
                        result = B_TRUE;
                }
                mutex_exit(&found_db->db_mtx);
index a09ac4f9194ad9ad731b714dab043e5d236a4990..a76cdd9f1e67275af103c2e75983b0c99cce0c13 100644 (file)
@@ -342,7 +342,7 @@ dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **dbp)
        db = dn->dn_bonus;
 
        /* as long as the bonus buf is held, the dnode will be held */
-       if (refcount_add(&db->db_holds, tag) == 1) {
+       if (zfs_refcount_add(&db->db_holds, tag) == 1) {
                VERIFY(dnode_add_ref(dn, db));
                atomic_inc_32(&dn->dn_dbufs_count);
        }
index 6ebff267144fbdd1471308aa9b6bfcf326a1871f..b1508ffac7df3316caac6c1394b9bd09ce40a17a 100644 (file)
@@ -114,7 +114,7 @@ dmu_tx_hold_dnode_impl(dmu_tx_t *tx, dnode_t *dn, enum dmu_tx_hold_type type,
        dmu_tx_hold_t *txh;
 
        if (dn != NULL) {
-               (void) refcount_add(&dn->dn_holds, tx);
+               (void) zfs_refcount_add(&dn->dn_holds, tx);
                if (tx->tx_txg != 0) {
                        mutex_enter(&dn->dn_mtx);
                        /*
@@ -124,7 +124,7 @@ dmu_tx_hold_dnode_impl(dmu_tx_t *tx, dnode_t *dn, enum dmu_tx_hold_type type,
                         */
                        ASSERT(dn->dn_assigned_txg == 0);
                        dn->dn_assigned_txg = tx->tx_txg;
-                       (void) refcount_add(&dn->dn_tx_holds, tx);
+                       (void) zfs_refcount_add(&dn->dn_tx_holds, tx);
                        mutex_exit(&dn->dn_mtx);
                }
        }
@@ -916,7 +916,7 @@ dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how)
                        if (dn->dn_assigned_txg == 0)
                                dn->dn_assigned_txg = tx->tx_txg;
                        ASSERT3U(dn->dn_assigned_txg, ==, tx->tx_txg);
-                       (void) refcount_add(&dn->dn_tx_holds, tx);
+                       (void) zfs_refcount_add(&dn->dn_tx_holds, tx);
                        mutex_exit(&dn->dn_mtx);
                }
                towrite += refcount_count(&txh->txh_space_towrite);
index 4a169c49acfed2fdc1ec60466af27a2df0a8b2a2..77d38c3685112c73d2cbca283777133585a17251 100644 (file)
@@ -1267,7 +1267,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
                if ((flag & DNODE_MUST_BE_FREE) && type != DMU_OT_NONE)
                        return (SET_ERROR(EEXIST));
                DNODE_VERIFY(dn);
-               (void) refcount_add(&dn->dn_holds, tag);
+               (void) zfs_refcount_add(&dn->dn_holds, tag);
                *dnp = dn;
                return (0);
        }
@@ -1484,7 +1484,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
                return (type == DMU_OT_NONE ? ENOENT : EEXIST);
        }
 
-       if (refcount_add(&dn->dn_holds, tag) == 1)
+       if (zfs_refcount_add(&dn->dn_holds, tag) == 1)
                dbuf_add_ref(db, dnh);
 
        mutex_exit(&dn->dn_mtx);
@@ -1524,7 +1524,7 @@ dnode_add_ref(dnode_t *dn, void *tag)
                mutex_exit(&dn->dn_mtx);
                return (FALSE);
        }
-       VERIFY(1 < refcount_add(&dn->dn_holds, tag));
+       VERIFY(1 < zfs_refcount_add(&dn->dn_holds, tag));
        mutex_exit(&dn->dn_mtx);
        return (TRUE);
 }
index bd03b486858bd3ba039c957bc5f94839ef13a9a4..b7562bcda47bad3edd0d8400ba33957b415664f6 100644 (file)
@@ -645,7 +645,7 @@ void
 dsl_dataset_long_hold(dsl_dataset_t *ds, void *tag)
 {
        ASSERT(dsl_pool_config_held(ds->ds_dir->dd_pool));
-       (void) refcount_add(&ds->ds_longholds, tag);
+       (void) zfs_refcount_add(&ds->ds_longholds, tag);
 }
 
 void
index ee24850dd0459eae6e280e199438f696cf450baa..40658d516842f3c918ca2f7d3d937ec382c077c1 100644 (file)
@@ -2663,7 +2663,7 @@ metaslab_group_alloc_increment(spa_t *spa, uint64_t vdev, void *tag, int flags)
        if (!mg->mg_class->mc_alloc_throttle_enabled)
                return;
 
-       (void) refcount_add(&mg->mg_alloc_queue_depth, tag);
+       (void) zfs_refcount_add(&mg->mg_alloc_queue_depth, tag);
 }
 
 void
@@ -3360,7 +3360,7 @@ metaslab_class_throttle_reserve(metaslab_class_t *mc, int slots, zio_t *zio,
                 * them individually when an I/O completes.
                 */
                for (d = 0; d < slots; d++) {
-                       reserved_slots = refcount_add(&mc->mc_alloc_slots, zio);
+                       reserved_slots = zfs_refcount_add(&mc->mc_alloc_slots, zio);
                }
                zio->io_flags |= ZIO_FLAG_IO_ALLOCATING;
                slot_reserved = B_TRUE;
index a151aceaecfbd2a0b47d524d0e6a1dbb5453e4f6..13f9bb6b76e34ab51905752d373428cb6b670f4c 100644 (file)
@@ -55,7 +55,7 @@ refcount_fini(void)
 }
 
 void
-refcount_create(refcount_t *rc)
+refcount_create(zfs_refcount_t *rc)
 {
        mutex_init(&rc->rc_mtx, NULL, MUTEX_DEFAULT, NULL);
        list_create(&rc->rc_list, sizeof (reference_t),
@@ -68,21 +68,21 @@ refcount_create(refcount_t *rc)
 }
 
 void
-refcount_create_tracked(refcount_t *rc)
+refcount_create_tracked(zfs_refcount_t *rc)
 {
        refcount_create(rc);
        rc->rc_tracked = B_TRUE;
 }
 
 void
-refcount_create_untracked(refcount_t *rc)
+refcount_create_untracked(zfs_refcount_t *rc)
 {
        refcount_create(rc);
        rc->rc_tracked = B_FALSE;
 }
 
 void
-refcount_destroy_many(refcount_t *rc, uint64_t number)
+refcount_destroy_many(zfs_refcount_t *rc, uint64_t number)
 {
        reference_t *ref;
 
@@ -103,25 +103,25 @@ refcount_destroy_many(refcount_t *rc, uint64_t number)
 }
 
 void
-refcount_destroy(refcount_t *rc)
+refcount_destroy(zfs_refcount_t *rc)
 {
        refcount_destroy_many(rc, 0);
 }
 
 int
-refcount_is_zero(refcount_t *rc)
+refcount_is_zero(zfs_refcount_t *rc)
 {
        return (rc->rc_count == 0);
 }
 
 int64_t
-refcount_count(refcount_t *rc)
+refcount_count(zfs_refcount_t *rc)
 {
        return (rc->rc_count);
 }
 
 int64_t
-refcount_add_many(refcount_t *rc, uint64_t number, void *holder)
+refcount_add_many(zfs_refcount_t *rc, uint64_t number, void *holder)
 {
        reference_t *ref = NULL;
        int64_t count;
@@ -143,13 +143,13 @@ refcount_add_many(refcount_t *rc, uint64_t number, void *holder)
 }
 
 int64_t
-zfs_refcount_add(refcount_t *rc, void *holder)
+zfs_refcount_add(zfs_refcount_t *rc, void *holder)
 {
        return (refcount_add_many(rc, 1, holder));
 }
 
 int64_t
-refcount_remove_many(refcount_t *rc, uint64_t number, void *holder)
+refcount_remove_many(zfs_refcount_t *rc, uint64_t number, void *holder)
 {
        reference_t *ref;
        int64_t count;
@@ -197,13 +197,13 @@ refcount_remove_many(refcount_t *rc, uint64_t number, void *holder)
 }
 
 int64_t
-refcount_remove(refcount_t *rc, void *holder)
+refcount_remove(zfs_refcount_t *rc, void *holder)
 {
        return (refcount_remove_many(rc, 1, holder));
 }
 
 void
-refcount_transfer(refcount_t *dst, refcount_t *src)
+refcount_transfer(zfs_refcount_t *dst, zfs_refcount_t *src)
 {
        int64_t count, removed_count;
        list_t list, removed;
@@ -234,7 +234,7 @@ refcount_transfer(refcount_t *dst, refcount_t *src)
 }
 
 void
-refcount_transfer_ownership(refcount_t *rc, void *current_holder,
+refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
     void *new_holder)
 {
        reference_t *ref;
@@ -264,7 +264,7 @@ refcount_transfer_ownership(refcount_t *rc, void *current_holder,
  * might be held.
  */
 boolean_t
-refcount_held(refcount_t *rc, void *holder)
+refcount_held(zfs_refcount_t *rc, void *holder)
 {
        reference_t *ref;
 
@@ -292,7 +292,7 @@ refcount_held(refcount_t *rc, void *holder)
  * since the reference might not be held.
  */
 boolean_t
-refcount_not_held(refcount_t *rc, void *holder)
+refcount_not_held(zfs_refcount_t *rc, void *holder)
 {
        reference_t *ref;
 
index 704f76067bf09b6d48219a260dc260c0bc27699a..effff3305224b9d671a5ef1f9c58816a881799e8 100644 (file)
@@ -183,9 +183,9 @@ rrw_enter_read_impl(rrwlock_t *rrl, boolean_t prio, void *tag)
        if (rrl->rr_writer_wanted || rrl->rr_track_all) {
                /* may or may not be a re-entrant enter */
                rrn_add(rrl, tag);
-               (void) refcount_add(&rrl->rr_linked_rcount, tag);
+               (void) zfs_refcount_add(&rrl->rr_linked_rcount, tag);
        } else {
-               (void) refcount_add(&rrl->rr_anon_rcount, tag);
+               (void) zfs_refcount_add(&rrl->rr_anon_rcount, tag);
        }
        ASSERT(rrl->rr_writer == NULL);
        mutex_exit(&rrl->rr_lock);
index 1fb1a8b54a67969458875fe3018b122fe4e90ac5..df4f6fd8529c2fc5c9efe6ce6ce427e2e230bb92 100644 (file)
@@ -1337,7 +1337,7 @@ sa_idx_tab_hold(objset_t *os, sa_idx_tab_t *idx_tab)
        ASSERTV(sa_os_t *sa = os->os_sa);
 
        ASSERT(MUTEX_HELD(&sa->sa_lock));
-       (void) refcount_add(&idx_tab->sa_refcount, NULL);
+       (void) zfs_refcount_add(&idx_tab->sa_refcount, NULL);
 }
 
 void
index cc1c641d771989ebd18d0f7ed04c0fa4cc21ee27..f6c9b40bd337ef6ab2c16bb60333038924b4c6a2 100644 (file)
@@ -80,7 +80,7 @@
  *     definition they must have an existing reference, and will never need
  *     to lookup a spa_t by name.
  *
- * spa_refcount (per-spa refcount_t protected by mutex)
+ * spa_refcount (per-spa zfs_refcount_t protected by mutex)
  *
  *     This reference count keep track of any active users of the spa_t.  The
  *     spa_t cannot be destroyed or freed while this is non-zero.  Internally,
@@ -414,7 +414,7 @@ spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
                        }
                        scl->scl_writer = curthread;
                }
-               (void) refcount_add(&scl->scl_count, tag);
+               (void) zfs_refcount_add(&scl->scl_count, tag);
                mutex_exit(&scl->scl_lock);
        }
        return (1);
@@ -448,7 +448,7 @@ spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw)
                        }
                        scl->scl_writer = curthread;
                }
-               (void) refcount_add(&scl->scl_count, tag);
+               (void) zfs_refcount_add(&scl->scl_count, tag);
                mutex_exit(&scl->scl_lock);
        }
        ASSERT(wlocks_held <= locks);
@@ -768,7 +768,7 @@ spa_open_ref(spa_t *spa, void *tag)
 {
        ASSERT(refcount_count(&spa->spa_refcount) >= spa->spa_minref ||
            MUTEX_HELD(&spa_namespace_lock));
-       (void) refcount_add(&spa->spa_refcount, tag);
+       (void) zfs_refcount_add(&spa->spa_refcount, tag);
 }
 
 /*
index 98897fe6e05419d0c1708e58a71a7285128cef3a..579f1fbfb9a76f2c1c648eabc0df0c22dfbe795c 100644 (file)
@@ -120,7 +120,7 @@ typedef struct {
        taskqid_t       se_taskqid;     /* scheduled unmount taskqid */
        avl_node_t      se_node_name;   /* zfs_snapshots_by_name link */
        avl_node_t      se_node_objsetid; /* zfs_snapshots_by_objsetid link */
-       refcount_t      se_refcount;    /* reference count */
+       zfs_refcount_t  se_refcount;    /* reference count */
 } zfs_snapentry_t;
 
 static void zfsctl_snapshot_unmount_delay_impl(zfs_snapentry_t *se, int delay);
@@ -169,7 +169,7 @@ zfsctl_snapshot_free(zfs_snapentry_t *se)
 static void
 zfsctl_snapshot_hold(zfs_snapentry_t *se)
 {
-       refcount_add(&se->se_refcount, NULL);
+       zfs_refcount_add(&se->se_refcount, NULL);
 }
 
 /*
@@ -192,7 +192,7 @@ static void
 zfsctl_snapshot_add(zfs_snapentry_t *se)
 {
        ASSERT(RW_WRITE_HELD(&zfs_snapshot_lock));
-       refcount_add(&se->se_refcount, NULL);
+       zfs_refcount_add(&se->se_refcount, NULL);
        avl_add(&zfs_snapshots_by_name, se);
        avl_add(&zfs_snapshots_by_objsetid, se);
 }
@@ -269,7 +269,7 @@ zfsctl_snapshot_find_by_name(char *snapname)
        search.se_name = snapname;
        se = avl_find(&zfs_snapshots_by_name, &search, NULL);
        if (se)
-               refcount_add(&se->se_refcount, NULL);
+               zfs_refcount_add(&se->se_refcount, NULL);
 
        return (se);
 }
@@ -290,7 +290,7 @@ zfsctl_snapshot_find_by_objsetid(spa_t *spa, uint64_t objsetid)
        search.se_objsetid = objsetid;
        se = avl_find(&zfs_snapshots_by_objsetid, &search, NULL);
        if (se)
-               refcount_add(&se->se_refcount, NULL);
+               zfs_refcount_add(&se->se_refcount, NULL);
 
        return (se);
 }
index e222c791183469f78265ce0a36cff42c9a784ad7..0ca10f82e7571572ccaf366530d05b4346e94ec2 100644 (file)
@@ -272,7 +272,7 @@ zfs_znode_hold_enter(zfsvfs_t *zfsvfs, uint64_t obj)
                ASSERT3U(zh->zh_obj, ==, obj);
                found = B_TRUE;
        }
-       refcount_add(&zh->zh_refcount, NULL);
+       zfs_refcount_add(&zh->zh_refcount, NULL);
        mutex_exit(&zfsvfs->z_hold_locks[i]);
 
        if (found == B_TRUE)