Hi.

I just noticed that we have a bug fix in FreeBSD that I never reported
back. The thing is that ZFS creates dnode cache zone:

        dnode_cache = kmem_cache_create("dnode_t",
            sizeof (dnode_t),
            0, dnode_cons, dnode_dest, NULL, NULL, NULL, 0);

And declares dnode_cons() as constructor callback. But in the code we
can find that dnode_cons() is called directly for the second time after
allocation:

        dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP);
        (void) dnode_cons(dn, NULL, 0); /* XXX */

This way we initialize everything in dnode_cons() twice, which might not
be critial on OpenSolaris, but it is critical on FreeBSD. And it is a
waste of time for both systems.

This simple patch works on FreeBSD:

--- dnode.c.orig        2009-09-05 14:01:09.971645686 +0200
+++ dnode.c     2009-09-05 14:01:28.208648713 +0200
@@ -276,7 +276,6 @@
     uint64_t object)
 {
        dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP);
-       (void) dnode_cons(dn, NULL, 0); /* XXX */
 
        dn->dn_objset = os;
        dn->dn_object = object;

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: 
<http://mail.opensolaris.org/pipermail/zfs-code/attachments/20090905/48510214/attachment.bin>

Reply via email to