aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_filestream.c
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 /fs/xfs/xfs_filestream.c
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>
Diffstat (limited to 'fs/xfs/xfs_filestream.c')
-rw-r--r--fs/xfs/xfs_filestream.c25
1 files changed, 3 insertions, 22 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}