summaryrefslogtreecommitdiffstats
path: root/include/sys
diff options
context:
space:
mode:
authorTim Schumacher <[email protected]>2018-09-26 19:29:26 +0200
committerBrian Behlendorf <[email protected]>2018-09-26 10:29:26 -0700
commitc13060e4787e9578dafad85a47c62457424bec9c (patch)
treebf05ff868e01b6d607a234026a659ff4b5e1a789 /include/sys
parent7a23c81342df05ace730bd303b4a73854dba43dd (diff)
Linux 4.19-rc3+ compat: Remove refcount_t compat
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tim Schumacher <[email protected]> Closes #7885 Closes #7932
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/abd.h2
-rw-r--r--include/sys/arc.h2
-rw-r--r--include/sys/arc_impl.h8
-rw-r--r--include/sys/dbuf.h2
-rw-r--r--include/sys/dmu_tx.h4
-rw-r--r--include/sys/dnode.h4
-rw-r--r--include/sys/dsl_crypt.h6
-rw-r--r--include/sys/dsl_dataset.h2
-rw-r--r--include/sys/metaslab_impl.h4
-rw-r--r--include/sys/refcount.h52
-rw-r--r--include/sys/rrwlock.h4
-rw-r--r--include/sys/sa_impl.h2
-rw-r--r--include/sys/spa_impl.h6
-rw-r--r--include/sys/zap.h2
-rw-r--r--include/sys/zfs_znode.h2
15 files changed, 48 insertions, 54 deletions
diff --git a/include/sys/abd.h b/include/sys/abd.h
index 077bb9d17..3d9fdbf10 100644
--- a/include/sys/abd.h
+++ b/include/sys/abd.h
@@ -51,7 +51,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;
diff --git a/include/sys/arc.h b/include/sys/arc.h
index a5bdefb56..dc2fd0364 100644
--- a/include/sys/arc.h
+++ b/include/sys/arc.h
@@ -87,7 +87,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 {
diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h
index 52863bba4..cd42c0c01 100644
--- a/include/sys/arc_impl.h
+++ b/include/sys/arc_impl.h
@@ -75,12 +75,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
*/
@@ -168,7 +168,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;
@@ -215,7 +215,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 {
diff --git a/include/sys/dbuf.h b/include/sys/dbuf.h
index ab0950c83..eea9e265b 100644
--- a/include/sys/dbuf.h
+++ b/include/sys/dbuf.h
@@ -230,7 +230,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;
diff --git a/include/sys/dmu_tx.h b/include/sys/dmu_tx.h
index 6a4bd3fac..36d205e95 100644
--- a/include/sys/dmu_tx.h
+++ b/include/sys/dmu_tx.h
@@ -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;
diff --git a/include/sys/dnode.h b/include/sys/dnode.h
index 0774e663f..48ef927d4 100644
--- a/include/sys/dnode.h
+++ b/include/sys/dnode.h
@@ -335,8 +335,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;
/*
diff --git a/include/sys/dsl_crypt.h b/include/sys/dsl_crypt.h
index 8766ce51e..c6d2b0a16 100644
--- a/include/sys/dsl_crypt.h
+++ b/include/sys/dsl_crypt.h
@@ -62,7 +62,7 @@ typedef struct dsl_wrapping_key {
crypto_key_t wk_key;
/* refcount of number of dsl_crypto_key_t's holding this struct */
- refcount_t wk_refcnt;
+ zfs_refcount_t wk_refcnt;
/* dsl directory object that owns this wrapping key */
uint64_t wk_ddobj;
@@ -112,7 +112,7 @@ typedef struct dsl_crypto_key {
avl_node_t dck_avl_link;
/* refcount of dsl_key_mapping_t's holding this key */
- refcount_t dck_holds;
+ zfs_refcount_t dck_holds;
/* master key used to derive encryption keys */
zio_crypt_key_t dck_key;
@@ -134,7 +134,7 @@ typedef struct dsl_key_mapping {
avl_node_t km_avl_link;
/* refcount of how many users are depending on this mapping */
- refcount_t km_refcnt;
+ zfs_refcount_t km_refcnt;
/* dataset this crypto key belongs to (index) */
uint64_t km_dsobj;
diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h
index dbe4cb706..768241483 100644
--- a/include/sys/dsl_dataset.h
+++ b/include/sys/dsl_dataset.h
@@ -211,7 +211,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;
diff --git a/include/sys/metaslab_impl.h b/include/sys/metaslab_impl.h
index cc6e8b796..aa1c82a02 100644
--- a/include/sys/metaslab_impl.h
+++ b/include/sys/metaslab_impl.h
@@ -184,7 +184,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 */
@@ -256,7 +256,7 @@ struct metaslab_group {
*/
uint64_t mg_max_alloc_queue_depth;
uint64_t *mg_cur_max_alloc_queue_depth;
- refcount_t *mg_alloc_queue_depth;
+ zfs_refcount_t *mg_alloc_queue_depth;
int mg_allocators;
/*
* A metalab group that can no longer allocate the minimum block
diff --git a/include/sys/refcount.h b/include/sys/refcount.h
index 02002ec2f..e20ffbc30 100644
--- a/include/sys/refcount.h
+++ b/include/sys/refcount.h
@@ -41,17 +41,6 @@ extern "C" {
*/
#define FTAG ((char *)(uintptr_t)__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)
diff --git a/include/sys/rrwlock.h b/include/sys/rrwlock.h
index 7a328fd68..e1c1756cf 100644
--- a/include/sys/rrwlock.h
+++ b/include/sys/rrwlock.h
@@ -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;
diff --git a/include/sys/sa_impl.h b/include/sys/sa_impl.h
index b68b7610b..7eddd8750 100644
--- a/include/sys/sa_impl.h
+++ b/include/sys/sa_impl.h
@@ -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;
diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h
index 676e8b8a2..9dbdcfcf5 100644
--- a/include/sys/spa_impl.h
+++ b/include/sys/spa_impl.h
@@ -139,7 +139,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 {
@@ -387,12 +387,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 */
};
diff --git a/include/sys/zap.h b/include/sys/zap.h
index 43b7fbd26..7acc3becb 100644
--- a/include/sys/zap.h
+++ b/include/sys/zap.h
@@ -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.
diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h
index e82ac9941..01f4328f0 100644
--- a/include/sys/zfs_znode.h
+++ b/include/sys/zfs_znode.h
@@ -223,7 +223,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;
static inline uint64_t