Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352950
b: refs/heads/master
c: c76c4d9
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Jan 29, 2013
1 parent d7c091e commit a6f3d26
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 57 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: 767f433f346959d6a09b85478eb5db133ab25c6f
refs/heads/master: c76c4d96bdd89027306cebc80eb3397286d8da66
7 changes: 0 additions & 7 deletions trunk/fs/gfs2/lops.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ static inline unsigned int databuf_limit(struct gfs2_sbd *sdp)
return limit;
}

static inline void lops_init_le(struct gfs2_bufdata *bd,
const struct gfs2_log_operations *lops)
{
INIT_LIST_HEAD(&bd->bd_list);
bd->bd_ops = lops;
}

static inline void lops_before_commit(struct gfs2_sbd *sdp)
{
int x;
Expand Down
35 changes: 0 additions & 35 deletions trunk/fs/gfs2/meta_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,41 +271,6 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
return 0;
}

/**
* gfs2_attach_bufdata - attach a struct gfs2_bufdata structure to a buffer
* @gl: the glock the buffer belongs to
* @bh: The buffer to be attached to
* @meta: Flag to indicate whether its metadata or not
*/

void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
int meta)
{
struct gfs2_bufdata *bd;

if (meta)
lock_page(bh->b_page);

if (bh->b_private) {
if (meta)
unlock_page(bh->b_page);
return;
}

bd = kmem_cache_zalloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL);
bd->bd_bh = bh;
bd->bd_gl = gl;

if (meta)
lops_init_le(bd, &gfs2_buf_lops);
else
lops_init_le(bd, &gfs2_databuf_lops);
bh->b_private = bd;

if (meta)
unlock_page(bh->b_page);
}

void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta)
{
struct address_space *mapping = bh->b_page->mapping;
Expand Down
3 changes: 0 additions & 3 deletions trunk/fs/gfs2/meta_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno,
int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh);
struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create);

void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
int meta);

void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr,
int meta);

Expand Down
37 changes: 26 additions & 11 deletions trunk/fs/gfs2/trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,21 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
sb_end_intwrite(sdp->sd_vfs);
}

static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl,
struct buffer_head *bh,
const struct gfs2_log_operations *lops)
{
struct gfs2_bufdata *bd;

bd = kmem_cache_zalloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL);
bd->bd_bh = bh;
bd->bd_gl = gl;
bd->bd_ops = lops;
INIT_LIST_HEAD(&bd->bd_list);
bh->b_private = bd;
return bd;
}

/**
* databuf_lo_add - Add a databuf to the transaction.
*
Expand Down Expand Up @@ -190,16 +205,15 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
lock_buffer(bh);
gfs2_log_lock(sdp);
bd = bh->b_private;
if (bd)
gfs2_assert(sdp, bd->bd_gl == gl);
else {
if (bd == NULL) {
gfs2_log_unlock(sdp);
unlock_buffer(bh);
gfs2_attach_bufdata(gl, bh, 0);
bd = bh->b_private;
if (bh->b_private == NULL)
bd = gfs2_alloc_bufdata(gl, bh, &gfs2_databuf_lops);
lock_buffer(bh);
gfs2_log_lock(sdp);
}
gfs2_assert(sdp, bd->bd_gl == gl);
databuf_lo_add(sdp, bd);
gfs2_log_unlock(sdp);
unlock_buffer(bh);
Expand Down Expand Up @@ -240,16 +254,17 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
lock_buffer(bh);
gfs2_log_lock(sdp);
bd = bh->b_private;
if (bd)
gfs2_assert(sdp, bd->bd_gl == gl);
else {
if (bd == NULL) {
gfs2_log_unlock(sdp);
unlock_buffer(bh);
gfs2_attach_bufdata(gl, bh, 1);
bd = bh->b_private;
lock_page(bh->b_page);
if (bh->b_private == NULL)
bd = gfs2_alloc_bufdata(gl, bh, &gfs2_buf_lops);
unlock_page(bh->b_page);
lock_buffer(bh);
gfs2_log_lock(sdp);
}
gfs2_assert(sdp, bd->bd_gl == gl);
meta_lo_add(sdp, bd);
gfs2_log_unlock(sdp);
unlock_buffer(bh);
Expand All @@ -263,7 +278,7 @@ void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
BUG_ON(!list_empty(&bd->bd_list));
BUG_ON(!list_empty(&bd->bd_ail_st_list));
BUG_ON(!list_empty(&bd->bd_ail_gl_list));
lops_init_le(bd, &gfs2_revoke_lops);
bd->bd_ops = &gfs2_revoke_lops;
tr->tr_touched = 1;
tr->tr_num_revoke++;
sdp->sd_log_num_revoke++;
Expand Down

0 comments on commit a6f3d26

Please sign in to comment.