X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fxfs%2Flinux-2.6%2Fxfs_super.c;h=3a2e961eaa6c3299724cb5b56b2d9aa40da47818;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=8bed3a1b9a41fbbcb8a09c3a9a3a312a6c355342;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 8bed3a1b9..3a2e961ea 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c @@ -76,7 +76,8 @@ STATIC struct quotactl_ops linvfs_qops; STATIC struct super_operations linvfs_sops; STATIC struct export_operations linvfs_export_ops; -STATIC kmem_cache_t * linvfs_inode_cachep; +STATIC kmem_zone_t *linvfs_inode_zone; +STATIC kmem_shaker_t xfs_inode_shaker; STATIC struct xfs_mount_args * xfs_args_allocate( @@ -297,7 +298,7 @@ linvfs_alloc_inode( { vnode_t *vp; - vp = (vnode_t *)kmem_cache_alloc(linvfs_inode_cachep, + vp = (vnode_t *)kmem_cache_alloc(linvfs_inode_zone, kmem_flags_convert(KM_SLEEP)); if (!vp) return NULL; @@ -308,7 +309,20 @@ STATIC void linvfs_destroy_inode( struct inode *inode) { - kmem_cache_free(linvfs_inode_cachep, LINVFS_GET_VP(inode)); + kmem_cache_free(linvfs_inode_zone, LINVFS_GET_VP(inode)); +} + +int +xfs_inode_shake( + int priority, + unsigned int gfp_mask) +{ + int pages; + + + pages = kmem_zone_shrink(linvfs_inode_zone); + pages += kmem_zone_shrink(xfs_inode_zone); + return pages; } STATIC void @@ -327,12 +341,12 @@ init_once( STATIC int init_inodecache( void ) { - linvfs_inode_cachep = kmem_cache_create("linvfs_icache", + linvfs_inode_zone = kmem_cache_create("linvfs_icache", sizeof(vnode_t), 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, init_once, NULL); - if (linvfs_inode_cachep == NULL) + if (linvfs_inode_zone == NULL) return -ENOMEM; return 0; } @@ -340,7 +354,7 @@ init_inodecache( void ) STATIC void destroy_inodecache( void ) { - if (kmem_cache_destroy(linvfs_inode_cachep)) + if (kmem_cache_destroy(linvfs_inode_zone)) printk(KERN_WARNING "%s: cache still in use!\n", __FUNCTION__); } @@ -843,15 +857,24 @@ init_xfs_fs( void ) vn_init(); xfs_init(); uuid_init(); - vfs_initdmapi(); vfs_initquota(); + xfs_inode_shaker = kmem_shake_register(xfs_inode_shake); + if (!xfs_inode_shaker) { + error = -ENOMEM; + goto undo_shaker; + } + error = register_filesystem(&xfs_fs_type); if (error) goto undo_register; + XFS_DM_INIT(&xfs_fs_type); return 0; undo_register: + kmem_shake_deregister(xfs_inode_shaker); + +undo_shaker: pagebuf_terminate(); undo_pagebuf: @@ -865,8 +888,9 @@ STATIC void __exit exit_xfs_fs( void ) { vfs_exitquota(); - vfs_exitdmapi(); + XFS_DM_EXIT(&xfs_fs_type); unregister_filesystem(&xfs_fs_type); + kmem_shake_deregister(xfs_inode_shaker); xfs_cleanup(); pagebuf_terminate(); destroy_inodecache();