aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-10-30 01:11:59 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 01:11:59 -0400
commit07c8f67587724b417f60bffb32c448dd94647b54 (patch)
tree01f6cf39be93dd5515481d09d282c503e05ef79f /fs/xfs/linux-2.6/xfs_super.c
parente946217e4fdaa67681bbabfa8e6b18641921f750 (diff)
[XFS] Make use of the init-once slab optimisation.
To avoid having to initialise some fields of the XFS inode on every allocation, we can use the slab init-once feature to initialise them. All we have to guarantee is that when we free the inode, all it's entries are in the initial state. Add asserts where possible to ensure debug kernels check this initial state before freeing and after allocation. SGI-PV: 981498 SGI-Modid: xfs-linux-melb:xfs-kern:31925a 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.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 37ebe36056eb..d1c4dec51a3b 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -887,6 +887,41 @@ xfs_fs_inode_init_once(
887 inode_init_once((struct inode *)vnode); 887 inode_init_once((struct inode *)vnode);
888} 888}
889 889
890
891/*
892 * Slab object creation initialisation for the XFS inode.
893 * This covers only the idempotent fields in the XFS inode;
894 * all other fields need to be initialised on allocation
895 * from the slab. This avoids the need to repeatedly intialise
896 * fields in the xfs inode that left in the initialise state
897 * when freeing the inode.
898 */
899void
900xfs_inode_init_once(
901 kmem_zone_t *zone,
902 void *inode)
903{
904 struct xfs_inode *ip = inode;
905
906 memset(ip, 0, sizeof(struct xfs_inode));
907 atomic_set(&ip->i_iocount, 0);
908 atomic_set(&ip->i_pincount, 0);
909 spin_lock_init(&ip->i_flags_lock);
910 INIT_LIST_HEAD(&ip->i_reclaim);
911 init_waitqueue_head(&ip->i_ipin_wait);
912 /*
913 * Because we want to use a counting completion, complete
914 * the flush completion once to allow a single access to
915 * the flush completion without blocking.
916 */
917 init_completion(&ip->i_flush);
918 complete(&ip->i_flush);
919
920 mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER,
921 "xfsino", ip->i_ino);
922 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino);
923}
924
890/* 925/*
891 * Attempt to flush the inode, this will actually fail 926 * Attempt to flush the inode, this will actually fail
892 * if the inode is pinned, but we dirty the inode again 927 * if the inode is pinned, but we dirty the inode again
@@ -2018,7 +2053,7 @@ xfs_init_zones(void)
2018 xfs_inode_zone = 2053 xfs_inode_zone =
2019 kmem_zone_init_flags(sizeof(xfs_inode_t), "xfs_inode", 2054 kmem_zone_init_flags(sizeof(xfs_inode_t), "xfs_inode",
2020 KM_ZONE_HWALIGN | KM_ZONE_RECLAIM | 2055 KM_ZONE_HWALIGN | KM_ZONE_RECLAIM |
2021 KM_ZONE_SPREAD, NULL); 2056 KM_ZONE_SPREAD, xfs_inode_init_once);
2022 if (!xfs_inode_zone) 2057 if (!xfs_inode_zone)
2023 goto out_destroy_efi_zone; 2058 goto out_destroy_efi_zone;
2024 2059