aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-10-30 02:36:14 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:36:14 -0400
commitbf904248a2adb3f3be4eb4fb1837ce3bb28cca76 (patch)
tree288306924f640f19d881166a3b50fa59b6e9e7e7 /fs/xfs/linux-2.6/xfs_super.c
parent8290c35f87304a6b73d4fd17b03580b4f7425de8 (diff)
[XFS] Combine the XFS and Linux inodes
To avoid issues with different lifecycles of XFS and Linux inodes, embedd the linux inode inside the XFS inode. This means that the linux inode has the same lifecycle as the XFS inode, even when it has been released by the OS. XFS inodes don't live much longer than this (a short stint in reclaim at most), so there isn't significant memory usage penalties here. Version 3 o kill xfs_icount() Version 2 o remove unused commented out code from xfs_iget(). o kill useless cast in VFS_I() SGI-PV: 988141 SGI-Modid: xfs-linux-melb:xfs-kern:32323a Signed-off-by: David Chinner <david@fromorbit.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index b87e45577a58..c6ef684bf2e3 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -72,7 +72,6 @@
72 72
73static struct quotactl_ops xfs_quotactl_operations; 73static struct quotactl_ops xfs_quotactl_operations;
74static struct super_operations xfs_super_operations; 74static struct super_operations xfs_super_operations;
75static kmem_zone_t *xfs_vnode_zone;
76static kmem_zone_t *xfs_ioend_zone; 75static kmem_zone_t *xfs_ioend_zone;
77mempool_t *xfs_ioend_pool; 76mempool_t *xfs_ioend_pool;
78 77
@@ -867,29 +866,24 @@ xfsaild_stop(
867} 866}
868 867
869 868
870 869/* Catch misguided souls that try to use this interface on XFS */
871STATIC struct inode * 870STATIC struct inode *
872xfs_fs_alloc_inode( 871xfs_fs_alloc_inode(
873 struct super_block *sb) 872 struct super_block *sb)
874{ 873{
875 return kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP); 874 BUG();
876} 875}
877 876
877/*
878 * we need to provide an empty inode free function to prevent
879 * the generic code from trying to free our combined inode.
880 */
878STATIC void 881STATIC void
879xfs_fs_destroy_inode( 882xfs_fs_destroy_inode(
880 struct inode *inode) 883 struct inode *inode)
881{
882 kmem_zone_free(xfs_vnode_zone, inode);
883}
884
885STATIC void
886xfs_fs_inode_init_once(
887 void *vnode)
888{ 884{
889 inode_init_once((struct inode *)vnode);
890} 885}
891 886
892
893/* 887/*
894 * Slab object creation initialisation for the XFS inode. 888 * Slab object creation initialisation for the XFS inode.
895 * This covers only the idempotent fields in the XFS inode; 889 * This covers only the idempotent fields in the XFS inode;
@@ -898,13 +892,18 @@ xfs_fs_inode_init_once(
898 * fields in the xfs inode that left in the initialise state 892 * fields in the xfs inode that left in the initialise state
899 * when freeing the inode. 893 * when freeing the inode.
900 */ 894 */
901void 895STATIC void
902xfs_inode_init_once( 896xfs_fs_inode_init_once(
903 void *inode) 897 void *inode)
904{ 898{
905 struct xfs_inode *ip = inode; 899 struct xfs_inode *ip = inode;
906 900
907 memset(ip, 0, sizeof(struct xfs_inode)); 901 memset(ip, 0, sizeof(struct xfs_inode));
902
903 /* vfs inode */
904 inode_init_once(VFS_I(ip));
905
906 /* xfs inode */
908 atomic_set(&ip->i_iocount, 0); 907 atomic_set(&ip->i_iocount, 0);
909 atomic_set(&ip->i_pincount, 0); 908 atomic_set(&ip->i_pincount, 0);
910 spin_lock_init(&ip->i_flags_lock); 909 spin_lock_init(&ip->i_flags_lock);
@@ -975,8 +974,6 @@ xfs_fs_clear_inode(
975 if (xfs_reclaim(ip)) 974 if (xfs_reclaim(ip))
976 panic("%s: cannot reclaim 0x%p\n", __func__, inode); 975 panic("%s: cannot reclaim 0x%p\n", __func__, inode);
977 } 976 }
978
979 ASSERT(XFS_I(inode) == NULL);
980} 977}
981 978
982STATIC void 979STATIC void
@@ -1829,16 +1826,10 @@ xfs_free_trace_bufs(void)
1829STATIC int __init 1826STATIC int __init
1830xfs_init_zones(void) 1827xfs_init_zones(void)
1831{ 1828{
1832 xfs_vnode_zone = kmem_zone_init_flags(sizeof(struct inode), "xfs_vnode",
1833 KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
1834 KM_ZONE_SPREAD,
1835 xfs_fs_inode_init_once);
1836 if (!xfs_vnode_zone)
1837 goto out;
1838 1829
1839 xfs_ioend_zone = kmem_zone_init(sizeof(xfs_ioend_t), "xfs_ioend"); 1830 xfs_ioend_zone = kmem_zone_init(sizeof(xfs_ioend_t), "xfs_ioend");
1840 if (!xfs_ioend_zone) 1831 if (!xfs_ioend_zone)
1841 goto out_destroy_vnode_zone; 1832 goto out;
1842 1833
1843 xfs_ioend_pool = mempool_create_slab_pool(4 * MAX_BUF_PER_PAGE, 1834 xfs_ioend_pool = mempool_create_slab_pool(4 * MAX_BUF_PER_PAGE,
1844 xfs_ioend_zone); 1835 xfs_ioend_zone);
@@ -1854,6 +1845,7 @@ xfs_init_zones(void)
1854 "xfs_bmap_free_item"); 1845 "xfs_bmap_free_item");
1855 if (!xfs_bmap_free_item_zone) 1846 if (!xfs_bmap_free_item_zone)
1856 goto out_destroy_log_ticket_zone; 1847 goto out_destroy_log_ticket_zone;
1848
1857 xfs_btree_cur_zone = kmem_zone_init(sizeof(xfs_btree_cur_t), 1849 xfs_btree_cur_zone = kmem_zone_init(sizeof(xfs_btree_cur_t),
1858 "xfs_btree_cur"); 1850 "xfs_btree_cur");
1859 if (!xfs_btree_cur_zone) 1851 if (!xfs_btree_cur_zone)
@@ -1901,8 +1893,8 @@ xfs_init_zones(void)
1901 1893
1902 xfs_inode_zone = 1894 xfs_inode_zone =
1903 kmem_zone_init_flags(sizeof(xfs_inode_t), "xfs_inode", 1895 kmem_zone_init_flags(sizeof(xfs_inode_t), "xfs_inode",
1904 KM_ZONE_HWALIGN | KM_ZONE_RECLAIM | 1896 KM_ZONE_HWALIGN | KM_ZONE_RECLAIM | KM_ZONE_SPREAD,
1905 KM_ZONE_SPREAD, xfs_inode_init_once); 1897 xfs_fs_inode_init_once);
1906 if (!xfs_inode_zone) 1898 if (!xfs_inode_zone)
1907 goto out_destroy_efi_zone; 1899 goto out_destroy_efi_zone;
1908 1900
@@ -1950,8 +1942,6 @@ xfs_init_zones(void)
1950 mempool_destroy(xfs_ioend_pool); 1942 mempool_destroy(xfs_ioend_pool);
1951 out_destroy_ioend_zone: 1943 out_destroy_ioend_zone:
1952 kmem_zone_destroy(xfs_ioend_zone); 1944 kmem_zone_destroy(xfs_ioend_zone);
1953 out_destroy_vnode_zone:
1954 kmem_zone_destroy(xfs_vnode_zone);
1955 out: 1945 out:
1956 return -ENOMEM; 1946 return -ENOMEM;
1957} 1947}
@@ -1976,7 +1966,6 @@ xfs_destroy_zones(void)
1976 kmem_zone_destroy(xfs_log_ticket_zone); 1966 kmem_zone_destroy(xfs_log_ticket_zone);
1977 mempool_destroy(xfs_ioend_pool); 1967 mempool_destroy(xfs_ioend_pool);
1978 kmem_zone_destroy(xfs_ioend_zone); 1968 kmem_zone_destroy(xfs_ioend_zone);
1979 kmem_zone_destroy(xfs_vnode_zone);
1980 1969
1981} 1970}
1982 1971