From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2] Use write_one_page() for writeback of in-place data
Date: Mon, 20 Aug 2007 16:06:33 +0100 [thread overview]
Message-ID: <1187622393.8765.922.camel@quoit> (raw)
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
reply other threads:[~2007-08-20 15:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1187622393.8765.922.camel@quoit \
--to=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.