Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292396
b: refs/heads/master
c: 75ca61c
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Mar 8, 2012
1 parent b256b4f commit 9fb7384
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35e478f42271673f79066a1ed008c6604621c6fe
refs/heads/master: 75ca61c101601a7071d93571920be9697b3fda9b
5 changes: 3 additions & 2 deletions trunk/fs/gfs2/lops.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/mempool.h>
#include <linux/gfs2_ondisk.h>
#include <linux/bio.h>
#include <linux/fs.h>
Expand Down Expand Up @@ -199,7 +200,7 @@ static void gfs2_fake_write_endio(struct buffer_head *bh, int uptodate)
struct gfs2_sbd *sdp = bd->bd_gl->gl_sbd;

end_buffer_write_sync(bh, uptodate);
free_buffer_head(bh);
mempool_free(bh, gfs2_bh_pool);
unlock_buffer(real_bh);
brelse(real_bh);
if (atomic_dec_and_test(&sdp->sd_log_in_flight))
Expand All @@ -220,7 +221,7 @@ static struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,
u64 blkno = gfs2_log_bmap(sdp, sdp->sd_log_flush_head);
struct buffer_head *bh;

bh = alloc_buffer_head(GFP_NOFS | __GFP_NOFAIL);
bh = mempool_alloc(gfs2_bh_pool, GFP_NOFS);
atomic_set(&bh->b_count, 1);
bh->b_state = (1 << BH_Mapped) | (1 << BH_Uptodate) | (1 << BH_Lock);
set_bh_page(bh, real->b_page, bh_offset(real));
Expand Down
18 changes: 18 additions & 0 deletions trunk/fs/gfs2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/rcupdate.h>
#include <linux/rculist_bl.h>
#include <linux/atomic.h>
#include <linux/mempool.h>

#include "gfs2.h"
#include "incore.h"
Expand Down Expand Up @@ -69,6 +70,16 @@ static void gfs2_init_gl_aspace_once(void *foo)
address_space_init_once(mapping);
}

static void *gfs2_bh_alloc(gfp_t mask, void *data)
{
return alloc_buffer_head(mask);
}

static void gfs2_bh_free(void *ptr, void *data)
{
return free_buffer_head(ptr);
}

/**
* init_gfs2_fs - Register GFS2 as a filesystem
*
Expand Down Expand Up @@ -151,6 +162,10 @@ static int __init init_gfs2_fs(void)
gfs2_control_wq = alloc_workqueue("gfs2_control",
WQ_NON_REENTRANT | WQ_UNBOUND | WQ_FREEZABLE, 0);
if (!gfs2_control_wq)
goto fail_recovery;

gfs2_bh_pool = mempool_create(1024, gfs2_bh_alloc, gfs2_bh_free, NULL);
if (!gfs2_bh_pool)
goto fail_control;

gfs2_register_debugfs();
Expand All @@ -160,6 +175,8 @@ static int __init init_gfs2_fs(void)
return 0;

fail_control:
destroy_workqueue(gfs2_control_wq);
fail_recovery:
destroy_workqueue(gfs_recovery_wq);
fail_wq:
unregister_filesystem(&gfs2meta_fs_type);
Expand Down Expand Up @@ -208,6 +225,7 @@ static void __exit exit_gfs2_fs(void)

rcu_barrier();

mempool_destroy(gfs2_bh_pool);
kmem_cache_destroy(gfs2_quotad_cachep);
kmem_cache_destroy(gfs2_rgrpd_cachep);
kmem_cache_destroy(gfs2_bufdata_cachep);
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/gfs2/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct kmem_cache *gfs2_inode_cachep __read_mostly;
struct kmem_cache *gfs2_bufdata_cachep __read_mostly;
struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
struct kmem_cache *gfs2_quotad_cachep __read_mostly;
mempool_t *gfs2_bh_pool __read_mostly;

void gfs2_assert_i(struct gfs2_sbd *sdp)
{
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/gfs2/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef __UTIL_DOT_H__
#define __UTIL_DOT_H__

#include <linux/mempool.h>

#include "incore.h"

#define fs_printk(level, fs, fmt, arg...) \
Expand Down Expand Up @@ -150,6 +152,7 @@ extern struct kmem_cache *gfs2_inode_cachep;
extern struct kmem_cache *gfs2_bufdata_cachep;
extern struct kmem_cache *gfs2_rgrpd_cachep;
extern struct kmem_cache *gfs2_quotad_cachep;
extern mempool_t *gfs2_bh_pool;

static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
unsigned int *p)
Expand Down

0 comments on commit 9fb7384

Please sign in to comment.