GFS2: Use slab for block reservation memory
This patch changes block reservations so it uses slab storage. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
b120193e36
commit
36f5580be1
@ -143,6 +143,12 @@ static int __init init_gfs2_fs(void)
|
|||||||
if (!gfs2_quotad_cachep)
|
if (!gfs2_quotad_cachep)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
gfs2_rsrv_cachep = kmem_cache_create("gfs2_mblk",
|
||||||
|
sizeof(struct gfs2_blkreserv),
|
||||||
|
0, 0, NULL);
|
||||||
|
if (!gfs2_rsrv_cachep)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
register_shrinker(&qd_shrinker);
|
register_shrinker(&qd_shrinker);
|
||||||
|
|
||||||
error = register_filesystem(&gfs2_fs_type);
|
error = register_filesystem(&gfs2_fs_type);
|
||||||
@ -186,6 +192,9 @@ fail:
|
|||||||
unregister_shrinker(&qd_shrinker);
|
unregister_shrinker(&qd_shrinker);
|
||||||
gfs2_glock_exit();
|
gfs2_glock_exit();
|
||||||
|
|
||||||
|
if (gfs2_rsrv_cachep)
|
||||||
|
kmem_cache_destroy(gfs2_rsrv_cachep);
|
||||||
|
|
||||||
if (gfs2_quotad_cachep)
|
if (gfs2_quotad_cachep)
|
||||||
kmem_cache_destroy(gfs2_quotad_cachep);
|
kmem_cache_destroy(gfs2_quotad_cachep);
|
||||||
|
|
||||||
@ -226,6 +235,7 @@ static void __exit exit_gfs2_fs(void)
|
|||||||
rcu_barrier();
|
rcu_barrier();
|
||||||
|
|
||||||
mempool_destroy(gfs2_bh_pool);
|
mempool_destroy(gfs2_bh_pool);
|
||||||
|
kmem_cache_destroy(gfs2_rsrv_cachep);
|
||||||
kmem_cache_destroy(gfs2_quotad_cachep);
|
kmem_cache_destroy(gfs2_quotad_cachep);
|
||||||
kmem_cache_destroy(gfs2_rgrpd_cachep);
|
kmem_cache_destroy(gfs2_rgrpd_cachep);
|
||||||
kmem_cache_destroy(gfs2_bufdata_cachep);
|
kmem_cache_destroy(gfs2_bufdata_cachep);
|
||||||
|
|||||||
@ -1002,11 +1002,13 @@ struct gfs2_qadata *gfs2_qadata_get(struct gfs2_inode *ip)
|
|||||||
* Returns: the struct gfs2_qadata
|
* Returns: the struct gfs2_qadata
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct gfs2_blkreserv *gfs2_blkrsv_get(struct gfs2_inode *ip)
|
static int gfs2_blkrsv_get(struct gfs2_inode *ip)
|
||||||
{
|
{
|
||||||
BUG_ON(ip->i_res != NULL);
|
BUG_ON(ip->i_res != NULL);
|
||||||
ip->i_res = kzalloc(sizeof(struct gfs2_blkreserv), GFP_NOFS);
|
ip->i_res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS);
|
||||||
return ip->i_res;
|
if (!ip->i_res)
|
||||||
|
return -ENOMEM;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1164,7 +1166,7 @@ static int get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked)
|
|||||||
static void gfs2_blkrsv_put(struct gfs2_inode *ip)
|
static void gfs2_blkrsv_put(struct gfs2_inode *ip)
|
||||||
{
|
{
|
||||||
BUG_ON(ip->i_res == NULL);
|
BUG_ON(ip->i_res == NULL);
|
||||||
kfree(ip->i_res);
|
kmem_cache_free(gfs2_rsrv_cachep, ip->i_res);
|
||||||
ip->i_res = NULL;
|
ip->i_res = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,14 +1181,15 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested)
|
|||||||
{
|
{
|
||||||
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
||||||
struct gfs2_blkreserv *rs;
|
struct gfs2_blkreserv *rs;
|
||||||
int error = 0;
|
int error;
|
||||||
u64 last_unlinked = NO_BLOCK;
|
u64 last_unlinked = NO_BLOCK;
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
|
|
||||||
rs = gfs2_blkrsv_get(ip);
|
error = gfs2_blkrsv_get(ip);
|
||||||
if (!rs)
|
if (error)
|
||||||
return -ENOMEM;
|
return error;
|
||||||
|
|
||||||
|
rs = ip->i_res;
|
||||||
rs->rs_requested = requested;
|
rs->rs_requested = requested;
|
||||||
if (gfs2_assert_warn(sdp, requested)) {
|
if (gfs2_assert_warn(sdp, requested)) {
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ struct kmem_cache *gfs2_inode_cachep __read_mostly;
|
|||||||
struct kmem_cache *gfs2_bufdata_cachep __read_mostly;
|
struct kmem_cache *gfs2_bufdata_cachep __read_mostly;
|
||||||
struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
|
struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
|
||||||
struct kmem_cache *gfs2_quotad_cachep __read_mostly;
|
struct kmem_cache *gfs2_quotad_cachep __read_mostly;
|
||||||
|
struct kmem_cache *gfs2_rsrv_cachep __read_mostly;
|
||||||
mempool_t *gfs2_bh_pool __read_mostly;
|
mempool_t *gfs2_bh_pool __read_mostly;
|
||||||
|
|
||||||
void gfs2_assert_i(struct gfs2_sbd *sdp)
|
void gfs2_assert_i(struct gfs2_sbd *sdp)
|
||||||
|
|||||||
@ -152,6 +152,7 @@ extern struct kmem_cache *gfs2_inode_cachep;
|
|||||||
extern struct kmem_cache *gfs2_bufdata_cachep;
|
extern struct kmem_cache *gfs2_bufdata_cachep;
|
||||||
extern struct kmem_cache *gfs2_rgrpd_cachep;
|
extern struct kmem_cache *gfs2_rgrpd_cachep;
|
||||||
extern struct kmem_cache *gfs2_quotad_cachep;
|
extern struct kmem_cache *gfs2_quotad_cachep;
|
||||||
|
extern struct kmem_cache *gfs2_rsrv_cachep;
|
||||||
extern mempool_t *gfs2_bh_pool;
|
extern mempool_t *gfs2_bh_pool;
|
||||||
|
|
||||||
static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
|
static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user