lkml.org 
[lkml]   [2006]   [Aug]   [10]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
DateThu, 10 Aug 2006 14:56:28 +0900
FromKAMEZAWA Hiroyuki <>
SubjectRe: [RFC] Simple Slab: A slab allocator with minimal meta information
On Wed, 9 Aug 2006 22:44:59 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> On Thu, 10 Aug 2006, KAMEZAWA Hiroyuki wrote:
> 
> > Because of inode_init_once, many codes which uses inode uses initilization code.
> > And inode is one of heavy users of slab.
> 
> Probably just code copied from the same location. It has the same name.
> 
for example, ext3's copy of init_once() is
--
static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
{
        struct ext3_inode_info *ei = (struct ext3_inode_info *) foo;
        if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
            SLAB_CTOR_CONSTRUCTOR) {
                INIT_LIST_HEAD(&ei->i_orphan);               ---------------(A)
#ifdef CONFIG_EXT3_FS_XATTR
                init_rwsem(&ei->xattr_sem);                  ---------------(B)
#endif
                mutex_init(&ei->truncate_mutex);             ---------------(C)
                inode_init_once(&ei->vfs_inode);
        }
}
--
(A) and (B) and (C) is only for ext3.

NFS's
--
static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
{
        struct nfs_inode *nfsi = (struct nfs_inode *) foo;
        if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
            SLAB_CTOR_CONSTRUCTOR) {
                inode_init_once(&nfsi->vfs_inode);
                spin_lock_init(&nfsi->req_lock);
                INIT_LIST_HEAD(&nfsi->dirty);
                INIT_LIST_HEAD(&nfsi->commit);
                INIT_LIST_HEAD(&nfsi->open_files);
                INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC);
                atomic_set(&nfsi->data_updates, 0);
                nfsi->ndirty = 0;
                nfsi->ncommit = 0;
                nfsi->npages = 0;
                nfs4_init_once(nfsi);
        }
}
--

Of cource, many of init_once() just call inode_init_once(). But some fs does
something special.

Thanks,
-Kame

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-08-10 05:57    [W:0.547 / U:0.090 seconds]
©2003-2008 Jasper Spaans