mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 02:49:32 +03:00
Fix list handling to only use the API
Remove all instances of list handling where the API is not used and instead list data members are directly accessed. Doing this sort of thing is bad for portability. Additionally, ensure that list_link_init() is called on newly created list nodes. This ensures the node is properly initialized and does not rely on the assumption that zero'ing the list_node_t via kmem_zalloc() is the same as proper initialization. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
59e6e7ca85
commit
98f72a539c
@ -794,6 +794,8 @@ hdr_cons(void *vbuf, void *unused, int kmflag)
|
||||
refcount_create(&buf->b_refcnt);
|
||||
cv_init(&buf->b_cv, NULL, CV_DEFAULT, NULL);
|
||||
mutex_init(&buf->b_freeze_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
list_link_init(&buf->b_arc_node);
|
||||
list_link_init(&buf->b_l2node);
|
||||
arc_space_consume(sizeof (arc_buf_hdr_t), ARC_SPACE_HDRS);
|
||||
|
||||
return (0);
|
||||
@ -4537,6 +4539,7 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd)
|
||||
adddev->l2ad_evict = adddev->l2ad_start;
|
||||
adddev->l2ad_first = B_TRUE;
|
||||
adddev->l2ad_writing = B_FALSE;
|
||||
list_link_init(&adddev->l2ad_node);
|
||||
ASSERT3U(adddev->l2ad_write, >, 0);
|
||||
|
||||
/*
|
||||
|
@ -55,6 +55,7 @@ dbuf_cons(void *vdb, void *unused, int kmflag)
|
||||
mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL);
|
||||
cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL);
|
||||
refcount_create(&db->db_holds);
|
||||
list_link_init(&db->db_link);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1136,6 +1137,7 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
|
||||
* transaction group won't leak out when we sync the older txg.
|
||||
*/
|
||||
dr = kmem_zalloc(sizeof (dbuf_dirty_record_t), KM_SLEEP);
|
||||
list_link_init(&dr->dr_dirty_node);
|
||||
if (db->db_level == 0) {
|
||||
void *data_old = db->db_buf;
|
||||
|
||||
|
@ -393,6 +393,7 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint64_t dsobj, void *tag,
|
||||
ds->ds_dbuf = dbuf;
|
||||
ds->ds_object = dsobj;
|
||||
ds->ds_phys = dbuf->db_data;
|
||||
list_link_init(&ds->ds_synced_link);
|
||||
|
||||
mutex_init(&ds->ds_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
mutex_init(&ds->ds_recvlock, NULL, MUTEX_DEFAULT, NULL);
|
||||
|
@ -317,6 +317,8 @@ vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid, vdev_ops_t *ops)
|
||||
vd->vdev_state = VDEV_STATE_CLOSED;
|
||||
vd->vdev_ishole = (ops == &vdev_hole_ops);
|
||||
|
||||
list_link_init(&vd->vdev_config_dirty_node);
|
||||
list_link_init(&vd->vdev_state_dirty_node);
|
||||
mutex_init(&vd->vdev_dtl_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
mutex_init(&vd->vdev_stat_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
mutex_init(&vd->vdev_probe_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user