aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-04-22 17:11:51 -0400
committerDave Chinner <david@fromorbit.com>2014-04-22 17:11:51 -0400
commit1919adda0732e661c6163a6505dddb0bc423b8d8 (patch)
tree401679adbf7a8bbc883771d32b36ff9ea91c396d
parent2cd2ef6a300b1ac912bb515b75451585c3d33ea9 (diff)
xfs: don't create a slab cache for filestream items
We only have very few of these around, and allocation isn't that much of a hot path. Remove the slab cache to simplify the code, and to not waste any resources for the usual case of not having any inodes that use the filestream allocator. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_filestream.c25
-rw-r--r--fs/xfs/xfs_filestream.h2
-rw-r--r--fs/xfs/xfs_super.c9
3 files changed, 4 insertions, 32 deletions
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
index ff6f90215c8a..7b9403690013 100644
--- a/fs/xfs/xfs_filestream.c
+++ b/fs/xfs/xfs_filestream.c
@@ -39,8 +39,6 @@
39#define TRACE_FREE(mp, ip, pip, ag, cnt) 39#define TRACE_FREE(mp, ip, pip, ag, cnt)
40#define TRACE_LOOKUP(mp, ip, pip, ag, cnt) 40#define TRACE_LOOKUP(mp, ip, pip, ag, cnt)
41 41
42static kmem_zone_t *item_zone;
43
44struct xfs_fstrm_item { 42struct xfs_fstrm_item {
45 struct xfs_mru_cache_elem mru; 43 struct xfs_mru_cache_elem mru;
46 struct xfs_inode *ip; 44 struct xfs_inode *ip;
@@ -141,7 +139,7 @@ xfs_fstrm_free_func(
141 TRACE_FREE(mp, ip, NULL, item->ag, 139 TRACE_FREE(mp, ip, NULL, item->ag,
142 xfs_filestream_peek_ag(mp, item->ag)); 140 xfs_filestream_peek_ag(mp, item->ag));
143 141
144 kmem_zone_free(item_zone, item); 142 kmem_free(item);
145} 143}
146 144
147/* 145/*
@@ -272,7 +270,7 @@ next_ag:
272 return 0; 270 return 0;
273 271
274 err = ENOMEM; 272 err = ENOMEM;
275 item = kmem_zone_zalloc(item_zone, KM_MAYFAIL); 273 item = kmem_alloc(sizeof(*item), KM_MAYFAIL);
276 if (!item) 274 if (!item)
277 goto out_put_ag; 275 goto out_put_ag;
278 276
@@ -289,7 +287,7 @@ next_ag:
289 return 0; 287 return 0;
290 288
291out_free_item: 289out_free_item:
292 kmem_zone_free(item_zone, item); 290 kmem_free(item);
293out_put_ag: 291out_put_ag:
294 xfs_filestream_put_ag(mp, *agp); 292 xfs_filestream_put_ag(mp, *agp);
295 return err; 293 return err;
@@ -474,20 +472,3 @@ xfs_filestream_unmount(
474{ 472{
475 xfs_mru_cache_destroy(mp->m_filestream); 473 xfs_mru_cache_destroy(mp->m_filestream);
476} 474}
477
478
479/* needs to return a positive errno for the init path */
480int
481xfs_filestream_init(void)
482{
483 item_zone = kmem_zone_init(sizeof(struct xfs_fstrm_item), "fstrm_item");
484 if (!item_zone)
485 return -ENOMEM;
486 return 0;
487}
488
489void
490xfs_filestream_uninit(void)
491{
492 kmem_zone_destroy(item_zone);
493}
diff --git a/fs/xfs/xfs_filestream.h b/fs/xfs/xfs_filestream.h
index e3a25f891d08..578d49e7cffc 100644
--- a/fs/xfs/xfs_filestream.h
+++ b/fs/xfs/xfs_filestream.h
@@ -22,8 +22,6 @@ struct xfs_mount;
22struct xfs_inode; 22struct xfs_inode;
23struct xfs_bmalloca; 23struct xfs_bmalloca;
24 24
25int xfs_filestream_init(void);
26void xfs_filestream_uninit(void);
27int xfs_filestream_mount(struct xfs_mount *mp); 25int xfs_filestream_mount(struct xfs_mount *mp);
28void xfs_filestream_unmount(struct xfs_mount *mp); 26void xfs_filestream_unmount(struct xfs_mount *mp);
29void xfs_filestream_deassociate(struct xfs_inode *ip); 27void xfs_filestream_deassociate(struct xfs_inode *ip);
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 205376776377..89a50e760177 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1754,13 +1754,9 @@ init_xfs_fs(void)
1754 if (error) 1754 if (error)
1755 goto out_destroy_wq; 1755 goto out_destroy_wq;
1756 1756
1757 error = xfs_filestream_init();
1758 if (error)
1759 goto out_mru_cache_uninit;
1760
1761 error = xfs_buf_init(); 1757 error = xfs_buf_init();
1762 if (error) 1758 if (error)
1763 goto out_filestream_uninit; 1759 goto out_mru_cache_uninit;
1764 1760
1765 error = xfs_init_procfs(); 1761 error = xfs_init_procfs();
1766 if (error) 1762 if (error)
@@ -1787,8 +1783,6 @@ init_xfs_fs(void)
1787 xfs_cleanup_procfs(); 1783 xfs_cleanup_procfs();
1788 out_buf_terminate: 1784 out_buf_terminate:
1789 xfs_buf_terminate(); 1785 xfs_buf_terminate();
1790 out_filestream_uninit:
1791 xfs_filestream_uninit();
1792 out_mru_cache_uninit: 1786 out_mru_cache_uninit:
1793 xfs_mru_cache_uninit(); 1787 xfs_mru_cache_uninit();
1794 out_destroy_wq: 1788 out_destroy_wq:
@@ -1807,7 +1801,6 @@ exit_xfs_fs(void)
1807 xfs_sysctl_unregister(); 1801 xfs_sysctl_unregister();
1808 xfs_cleanup_procfs(); 1802 xfs_cleanup_procfs();
1809 xfs_buf_terminate(); 1803 xfs_buf_terminate();
1810 xfs_filestream_uninit();
1811 xfs_mru_cache_uninit(); 1804 xfs_mru_cache_uninit();
1812 xfs_destroy_workqueues(); 1805 xfs_destroy_workqueues();
1813 xfs_destroy_zones(); 1806 xfs_destroy_zones();