On Wed, Nov 13, 2019 at 03:23:26PM +0100, Carlos Maiolino wrote: > Use kmem_cache_destroy directly > > Signed-off-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx> Looks ok, Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --D > --- > fs/xfs/kmem.h | 6 ---- > fs/xfs/xfs_buf.c | 2 +- > fs/xfs/xfs_dquot.c | 6 ++-- > fs/xfs/xfs_super.c | 70 +++++++++++++++++++++++----------------------- > 4 files changed, 39 insertions(+), 45 deletions(-) > > diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h > index 15c5800128b3..70ed74c7f37e 100644 > --- a/fs/xfs/kmem.h > +++ b/fs/xfs/kmem.h > @@ -87,12 +87,6 @@ kmem_zone_free(kmem_zone_t *zone, void *ptr) > kmem_cache_free(zone, ptr); > } > > -static inline void > -kmem_zone_destroy(kmem_zone_t *zone) > -{ > - kmem_cache_destroy(zone); > -} > - > extern void *kmem_zone_alloc(kmem_zone_t *, xfs_km_flags_t); > > static inline void * > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c > index 3741f5b369de..ccccfb792ff8 100644 > --- a/fs/xfs/xfs_buf.c > +++ b/fs/xfs/xfs_buf.c > @@ -2075,7 +2075,7 @@ xfs_buf_init(void) > void > xfs_buf_terminate(void) > { > - kmem_zone_destroy(xfs_buf_zone); > + kmem_cache_destroy(xfs_buf_zone); > } > > void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref) > diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c > index 90dd1623de5a..4f969d94fb74 100644 > --- a/fs/xfs/xfs_dquot.c > +++ b/fs/xfs/xfs_dquot.c > @@ -1226,7 +1226,7 @@ xfs_qm_init(void) > return 0; > > out_free_dqzone: > - kmem_zone_destroy(xfs_qm_dqzone); > + kmem_cache_destroy(xfs_qm_dqzone); > out: > return -ENOMEM; > } > @@ -1234,8 +1234,8 @@ xfs_qm_init(void) > void > xfs_qm_exit(void) > { > - kmem_zone_destroy(xfs_qm_dqtrxzone); > - kmem_zone_destroy(xfs_qm_dqzone); > + kmem_cache_destroy(xfs_qm_dqtrxzone); > + kmem_cache_destroy(xfs_qm_dqzone); > } > > /* > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c > index d3c3f7b5bdcf..d9ae27ddf253 100644 > --- a/fs/xfs/xfs_super.c > +++ b/fs/xfs/xfs_super.c > @@ -1921,39 +1921,39 @@ xfs_init_zones(void) > return 0; > > out_destroy_bud_zone: > - kmem_zone_destroy(xfs_bud_zone); > + kmem_cache_destroy(xfs_bud_zone); > out_destroy_cui_zone: > - kmem_zone_destroy(xfs_cui_zone); > + kmem_cache_destroy(xfs_cui_zone); > out_destroy_cud_zone: > - kmem_zone_destroy(xfs_cud_zone); > + kmem_cache_destroy(xfs_cud_zone); > out_destroy_rui_zone: > - kmem_zone_destroy(xfs_rui_zone); > + kmem_cache_destroy(xfs_rui_zone); > out_destroy_rud_zone: > - kmem_zone_destroy(xfs_rud_zone); > + kmem_cache_destroy(xfs_rud_zone); > out_destroy_icreate_zone: > - kmem_zone_destroy(xfs_icreate_zone); > + kmem_cache_destroy(xfs_icreate_zone); > out_destroy_ili_zone: > - kmem_zone_destroy(xfs_ili_zone); > + kmem_cache_destroy(xfs_ili_zone); > out_destroy_inode_zone: > - kmem_zone_destroy(xfs_inode_zone); > + kmem_cache_destroy(xfs_inode_zone); > out_destroy_efi_zone: > - kmem_zone_destroy(xfs_efi_zone); > + kmem_cache_destroy(xfs_efi_zone); > out_destroy_efd_zone: > - kmem_zone_destroy(xfs_efd_zone); > + kmem_cache_destroy(xfs_efd_zone); > out_destroy_buf_item_zone: > - kmem_zone_destroy(xfs_buf_item_zone); > + kmem_cache_destroy(xfs_buf_item_zone); > out_destroy_trans_zone: > - kmem_zone_destroy(xfs_trans_zone); > + kmem_cache_destroy(xfs_trans_zone); > out_destroy_ifork_zone: > - kmem_zone_destroy(xfs_ifork_zone); > + kmem_cache_destroy(xfs_ifork_zone); > out_destroy_da_state_zone: > - kmem_zone_destroy(xfs_da_state_zone); > + kmem_cache_destroy(xfs_da_state_zone); > out_destroy_btree_cur_zone: > - kmem_zone_destroy(xfs_btree_cur_zone); > + kmem_cache_destroy(xfs_btree_cur_zone); > out_destroy_bmap_free_item_zone: > - kmem_zone_destroy(xfs_bmap_free_item_zone); > + kmem_cache_destroy(xfs_bmap_free_item_zone); > out_destroy_log_ticket_zone: > - kmem_zone_destroy(xfs_log_ticket_zone); > + kmem_cache_destroy(xfs_log_ticket_zone); > out: > return -ENOMEM; > } > @@ -1966,24 +1966,24 @@ xfs_destroy_zones(void) > * destroy caches. > */ > rcu_barrier(); > - kmem_zone_destroy(xfs_bui_zone); > - kmem_zone_destroy(xfs_bud_zone); > - kmem_zone_destroy(xfs_cui_zone); > - kmem_zone_destroy(xfs_cud_zone); > - kmem_zone_destroy(xfs_rui_zone); > - kmem_zone_destroy(xfs_rud_zone); > - kmem_zone_destroy(xfs_icreate_zone); > - kmem_zone_destroy(xfs_ili_zone); > - kmem_zone_destroy(xfs_inode_zone); > - kmem_zone_destroy(xfs_efi_zone); > - kmem_zone_destroy(xfs_efd_zone); > - kmem_zone_destroy(xfs_buf_item_zone); > - kmem_zone_destroy(xfs_trans_zone); > - kmem_zone_destroy(xfs_ifork_zone); > - kmem_zone_destroy(xfs_da_state_zone); > - kmem_zone_destroy(xfs_btree_cur_zone); > - kmem_zone_destroy(xfs_bmap_free_item_zone); > - kmem_zone_destroy(xfs_log_ticket_zone); > + kmem_cache_destroy(xfs_bui_zone); > + kmem_cache_destroy(xfs_bud_zone); > + kmem_cache_destroy(xfs_cui_zone); > + kmem_cache_destroy(xfs_cud_zone); > + kmem_cache_destroy(xfs_rui_zone); > + kmem_cache_destroy(xfs_rud_zone); > + kmem_cache_destroy(xfs_icreate_zone); > + kmem_cache_destroy(xfs_ili_zone); > + kmem_cache_destroy(xfs_inode_zone); > + kmem_cache_destroy(xfs_efi_zone); > + kmem_cache_destroy(xfs_efd_zone); > + kmem_cache_destroy(xfs_buf_item_zone); > + kmem_cache_destroy(xfs_trans_zone); > + kmem_cache_destroy(xfs_ifork_zone); > + kmem_cache_destroy(xfs_da_state_zone); > + kmem_cache_destroy(xfs_btree_cur_zone); > + kmem_cache_destroy(xfs_bmap_free_item_zone); > + kmem_cache_destroy(xfs_log_ticket_zone); > } > > STATIC int __init > -- > 2.23.0 >