]> granicus.if.org Git - zfs/commitdiff
List cleanup and use of list_node_init initializer
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 13 Jan 2009 23:00:12 +0000 (15:00 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 13 Jan 2009 23:00:12 +0000 (15:00 -0800)
.topmsg
module/zfs/dbuf.c
module/zfs/dnode.c
module/zfs/include/sys/dbuf.h

diff --git a/.topmsg b/.topmsg
index 9fa80353b891a91886b8e2e1894e183d7d53934f..7980cebd4da11cf7c8d8f6525bb69e9d109d0a12 100644 (file)
--- a/.topmsg
+++ b/.topmsg
@@ -5,4 +5,9 @@ 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>
index d04610317a4ea42fdcf1becc7584513d09969ca3..f5f5daa3e4d517c8601013484946e0288985f29a 100644 (file)
@@ -1018,6 +1018,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;
 
index e77834d60dcc3d3615f7e68ddf1032f094905116..45ba90a6d6c933aeb799e38f5dd3e4175a046bb0 100644 (file)
@@ -280,6 +280,13 @@ dnode_create(objset_impl_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db,
        dn->dn_dbuf = db;
        dn->dn_phys = dnp;
 
+       list_link_init(&dn->dn_link);
+       {
+               int i;
+               for (i = 0; i < TXG_SIZE; i++)
+                       list_link_init(&dn->dn_dirty_link[i]);
+       }
+
        if (dnp->dn_datablkszsec)
                dnode_setdblksz(dn, dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT);
        dn->dn_indblkshift = dnp->dn_indblkshift;
index 75ce27264e3ce93f617e1ce01673f67c106d42a8..bea71f06f1feacdd624f0b113d1fb6d936b9e3a8 100644 (file)
@@ -85,9 +85,6 @@ struct dmu_tx;
  * etc.
  */
 
-#define        LIST_LINK_INACTIVE(link) \
-       ((link)->list_next == NULL && (link)->list_prev == NULL)
-
 struct dmu_buf_impl;
 
 typedef enum override_states {