Add bh_to_bufdata() function
From efc837e7d13dd81ea7f9b75919c00e0f98b6ddba Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Fri, 30 Nov 2007 14:14:51 +0000
Subject: [PATCH] [GFS2] Add bh_to_bufdata() function
This adds an inline function through which all accesses of bh->b_private go for journaled data and metadata buffers. A future patch will update this function so that its more than just a dereference.
Signed-off-by Steven Whitehouse <[email protected]>
fs/gfs2/incore.h +5 -0
@@ -128,6 +128,11 @@ struct gfs2_bufdata {struct list_head bd_ail_gl_list; }; +static inline struct gfs2_bufdata *bh_to_bufdata (const struct buffer_head *bh) +{ +return bh->b_private; +} +struct gfs2_glock_operations {void (*go_xmote_th) (struct gfs2_glock *gl);void (*go_xmote_bh) (struct gfs2_glock *gl);
fs/gfs2/log.c +1 -1
@@ -504,7 +504,7 @@ struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp)static void gfs2_fake_write_endio (struct buffer_head *bh,int uptodate) {struct buffer_head *real_bh = bh->b_private; -struct gfs2_bufdata *bd = real_bh->b_private; +struct gfs2_bufdata *bd =bh_to_bufdata (real_bh);struct gfs2_sbd *sdp = bd->bd_gl->gl_sbd;end_buffer_write_sync (bh, uptodate);
fs/gfs2/lops.c +2 -2
@@ -45,7 +45,7 @@ static void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh)gfs2_assert_withdraw (sdp,0 );if (!buffer_uptodate (bh))gfs2_io_error_bh (sdp, bh); - bd = bh->b_private; + bd =bh_to_bufdata (bh);/* If this buffer is in the AIL and it has already been written * to in-place disk block, remove it from the AIL. */
@@ -66,7 +66,7 @@ static void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh)static void gfs2_unpin (struct gfs2_sbd *sdp,struct buffer_head *bh,struct gfs2_ail *ai) { -struct gfs2_bufdata *bd = bh->b_private; +struct gfs2_bufdata *bd =bh_to_bufdata (bh);struct gfs2_glock *gl = bd->bd_gl;gfs2_assert_withdraw (sdp,buffer_uptodate (bh));
fs/gfs2/meta_io.c +2 -2
@@ -277,7 +277,7 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,if (meta)lock_page (bh->b_page); -if (bh->b_private) { +if (bh_to_bufdata (bh)) {if (meta)unlock_page (bh->b_page);return ;
@@ -301,7 +301,7 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,void gfs2_remove_from_journal (struct buffer_head *bh,struct gfs2_trans *tr,int meta) {struct gfs2_sbd *sdp =GFS2_SB (bh->b_page->mapping->host); -struct gfs2_bufdata *bd = bh->b_private; +struct gfs2_bufdata *bd =bh_to_bufdata (bh);if (test_clear_buffer_pinned (bh)) {atomic_dec (&sdp->sd_log_pinned);list_del_init (&bd->bd_le.le_list);
fs/gfs2/ops_address.c +3 -3
@@ -921,7 +921,7 @@ static void gfs2_discard(struct gfs2_sbd *sdp, struct buffer_head *bh)lock_buffer (bh);gfs2_log_lock (sdp);clear_buffer_dirty (bh); - bd = bh->b_private; + bd =bh_to_bufdata (bh);if (bd) {if (!list_empty (&bd->bd_le.le_list) && !buffer_pinned (bh))list_del_init (&bd->bd_le.le_list);
@@ -1047,7 +1047,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask) do { if (atomic_read(&bh->b_count)) goto cannot_release; - bd = bh->b_private; + bd = bh_to_bufdata(bh); if (bd && bd->bd_ail) goto cannot_release; gfs2_assert_warn(sdp, !buffer_pinned(bh));
@@ -1059,7 +1059,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask) head = bh =page_buffers (page); do { gfs2_log_lock(sdp); - bd = bh->b_private; + bd = bh_to_bufdata(bh); if (bd) { gfs2_assert_warn(sdp, bd->bd_bh == bh); gfs2_assert_warn(sdp, list_empty(&bd->bd_list_tr));
fs/gfs2/trans.c +2 -2
@@ -143,12 +143,12 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)struct gfs2_sbd *sdp = gl->gl_sbd;struct gfs2_bufdata *bd; - bd = bh->b_private; + bd =bh_to_bufdata (bh);if (bd)gfs2_assert (sdp, bd->bd_gl == gl);else {gfs2_attach_bufdata (gl, bh, meta); - bd = bh->b_private; + bd =bh_to_bufdata (bh); }lops_add (sdp, &bd->bd_le); }
Signature · 1 line
1.5.1.2