FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 12-12-2007, 03:27 PM
Steven Whitehouse
 
Default Add bh_to_bufdata() function

>From efc837e7d13dd81ea7f9b75919c00e0f98b6ddba Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <swhiteho@redhat.com>
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 <swhiteho@redhat.com>

diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 743ebba..4030e30 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -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);
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 9bece94..7fea147 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -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);
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 6b6ae8a..ceae8cf 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -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));
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 9688785..7410514 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -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);
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 8f94e30..cf8ef9e 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -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));
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index cebca7b..c1fdc1d 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -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);
}
--
1.5.1.2
 

Thread Tools




All times are GMT. The time now is 09:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org