cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2] Use write_one_page() for writeback of in-place data
@ 2007-08-20 15:06 Steven Whitehouse
  0 siblings, 0 replies; only message in thread
From: Steven Whitehouse @ 2007-08-20 15:06 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From fe2c07e31e0ed90422fab685eef97997d5befcac Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <swhiteho@redhat.com>
Date: Mon, 20 Aug 2007 15:48:00 +0100
Subject: [PATCH] [GFS2] Use write_one_page() for writeback of in-place data

When writing back in-place data, we need to hold the page lock
when testing whether a page (or bh) has been truncated or not.
This is tricky since the lists were designed to work with buffer
heads, but the following patch works well. If we do find a page
thats been truncated, we push the bh into the ail2 list.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index d0e6b42..76493a3 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -70,43 +70,43 @@ static void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
 {
 	struct gfs2_bufdata *bd, *s;
 	struct buffer_head *bh;
-	int retry;
 
 	BUG_ON(!spin_is_locked(&sdp->sd_log_lock));
 
-	do {
-		retry = 0;
-
-		list_for_each_entry_safe_reverse(bd, s, &ai->ai_ail1_list,
+	list_for_each_entry_safe_reverse(bd, s, &ai->ai_ail1_list,
 						 bd_ail_st_list) {
-			bh = bd->bd_bh;
-
-			gfs2_assert(sdp, bd->bd_ail == ai);
+		bh = bd->bd_bh;
+		gfs2_assert(sdp, bd->bd_ail == ai);
 
-			if (!buffer_busy(bh)) {
-				if (!buffer_uptodate(bh)) {
-					gfs2_log_unlock(sdp);
-					gfs2_io_error_bh(sdp, bh);
-					gfs2_log_lock(sdp);
-				}
-				list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
-				continue;
+		if (!buffer_busy(bh)) {
+			if (!buffer_uptodate(bh)) {
+				gfs2_log_unlock(sdp);
+				gfs2_io_error_bh(sdp, bh);
+				gfs2_log_lock(sdp);
 			}
+			list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
+			continue;
+		}
 
-			if (!buffer_dirty(bh))
-				continue;
+		if (!buffer_dirty(bh))
+			continue;
 
-			list_move(&bd->bd_ail_st_list, &ai->ai_ail1_list);
+		list_move(&bd->bd_ail_st_list, &ai->ai_ail1_list);
 
-			gfs2_log_unlock(sdp);
-			wait_on_buffer(bh);
-			ll_rw_block(WRITE, 1, &bh);
+		get_bh(bh);
+		gfs2_log_unlock(sdp);
+		lock_page(bh->b_page);
+		if (bh->b_page->mapping != NULL) {
+			write_one_page(bh->b_page, 0);
 			gfs2_log_lock(sdp);
-
-			retry = 1;
-			break;
+		} else {
+			unlock_page(bh->b_page);
+			gfs2_log_lock(sdp);
+			clear_buffer_dirty(bh);
+			list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
 		}
-	} while (retry);
+		brelse(bh);
+	}
 }
 
 /**
-- 
1.5.1.2





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-20 15:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-20 15:06 [Cluster-devel] [GFS2] Use write_one_page() for writeback of in-place data Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).