Commit 1919adda authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 2cd2ef6a
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#define TRACE_FREE(mp, ip, pip, ag, cnt) #define TRACE_FREE(mp, ip, pip, ag, cnt)
#define TRACE_LOOKUP(mp, ip, pip, ag, cnt) #define TRACE_LOOKUP(mp, ip, pip, ag, cnt)
static kmem_zone_t *item_zone;
struct xfs_fstrm_item { struct xfs_fstrm_item {
struct xfs_mru_cache_elem mru; struct xfs_mru_cache_elem mru;
struct xfs_inode *ip; struct xfs_inode *ip;
...@@ -141,7 +139,7 @@ xfs_fstrm_free_func( ...@@ -141,7 +139,7 @@ xfs_fstrm_free_func(
TRACE_FREE(mp, ip, NULL, item->ag, TRACE_FREE(mp, ip, NULL, item->ag,
xfs_filestream_peek_ag(mp, item->ag)); xfs_filestream_peek_ag(mp, item->ag));
kmem_zone_free(item_zone, item); kmem_free(item);
} }
/* /*
...@@ -272,7 +270,7 @@ xfs_filestream_pick_ag( ...@@ -272,7 +270,7 @@ xfs_filestream_pick_ag(
return 0; return 0;
err = ENOMEM; err = ENOMEM;
item = kmem_zone_zalloc(item_zone, KM_MAYFAIL); item = kmem_alloc(sizeof(*item), KM_MAYFAIL);
if (!item) if (!item)
goto out_put_ag; goto out_put_ag;
...@@ -289,7 +287,7 @@ xfs_filestream_pick_ag( ...@@ -289,7 +287,7 @@ xfs_filestream_pick_ag(
return 0; return 0;
out_free_item: out_free_item:
kmem_zone_free(item_zone, item); kmem_free(item);
out_put_ag: out_put_ag:
xfs_filestream_put_ag(mp, *agp); xfs_filestream_put_ag(mp, *agp);
return err; return err;
...@@ -474,20 +472,3 @@ xfs_filestream_unmount( ...@@ -474,20 +472,3 @@ xfs_filestream_unmount(
{ {
xfs_mru_cache_destroy(mp->m_filestream); xfs_mru_cache_destroy(mp->m_filestream);
} }
/* needs to return a positive errno for the init path */
int
xfs_filestream_init(void)
{
item_zone = kmem_zone_init(sizeof(struct xfs_fstrm_item), "fstrm_item");
if (!item_zone)
return -ENOMEM;
return 0;
}
void
xfs_filestream_uninit(void)
{
kmem_zone_destroy(item_zone);
}
...@@ -22,8 +22,6 @@ struct xfs_mount; ...@@ -22,8 +22,6 @@ struct xfs_mount;
struct xfs_inode; struct xfs_inode;
struct xfs_bmalloca; struct xfs_bmalloca;
int xfs_filestream_init(void);
void xfs_filestream_uninit(void);
int xfs_filestream_mount(struct xfs_mount *mp); int xfs_filestream_mount(struct xfs_mount *mp);
void xfs_filestream_unmount(struct xfs_mount *mp); void xfs_filestream_unmount(struct xfs_mount *mp);
void xfs_filestream_deassociate(struct xfs_inode *ip); void xfs_filestream_deassociate(struct xfs_inode *ip);
......
...@@ -1754,13 +1754,9 @@ init_xfs_fs(void) ...@@ -1754,13 +1754,9 @@ init_xfs_fs(void)
if (error) if (error)
goto out_destroy_wq; goto out_destroy_wq;
error = xfs_filestream_init();
if (error)
goto out_mru_cache_uninit;
error = xfs_buf_init(); error = xfs_buf_init();
if (error) if (error)
goto out_filestream_uninit; goto out_mru_cache_uninit;
error = xfs_init_procfs(); error = xfs_init_procfs();
if (error) if (error)
...@@ -1787,8 +1783,6 @@ init_xfs_fs(void) ...@@ -1787,8 +1783,6 @@ init_xfs_fs(void)
xfs_cleanup_procfs(); xfs_cleanup_procfs();
out_buf_terminate: out_buf_terminate:
xfs_buf_terminate(); xfs_buf_terminate();
out_filestream_uninit:
xfs_filestream_uninit();
out_mru_cache_uninit: out_mru_cache_uninit:
xfs_mru_cache_uninit(); xfs_mru_cache_uninit();
out_destroy_wq: out_destroy_wq:
...@@ -1807,7 +1801,6 @@ exit_xfs_fs(void) ...@@ -1807,7 +1801,6 @@ exit_xfs_fs(void)
xfs_sysctl_unregister(); xfs_sysctl_unregister();
xfs_cleanup_procfs(); xfs_cleanup_procfs();
xfs_buf_terminate(); xfs_buf_terminate();
xfs_filestream_uninit();
xfs_mru_cache_uninit(); xfs_mru_cache_uninit();
xfs_destroy_workqueues(); xfs_destroy_workqueues();
xfs_destroy_zones(); xfs_destroy_zones();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment