From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 02/24] GFS2: Optimise writepage for metadata
Date: Wed, 10 Jun 2009 09:30:43 +0100 [thread overview]
Message-ID: <1244622665-7470-3-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1244622665-7470-2-git-send-email-swhiteho@redhat.com>
This adds a GFS2 specific writepage for metadata, rather than
continuing to use the VFS function. As a result we now tag all
our metadata I/O with the correct flag so that blktraces will
now be less confusing.
Also, the generic function was checking for a number of corner
cases which cannot happen on the metadata address spaces so that
this should be faster too.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 75b2aec..78a5f43 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -33,17 +33,65 @@
#include "util.h"
#include "ops_address.h"
-static int aspace_get_block(struct inode *inode, sector_t lblock,
- struct buffer_head *bh_result, int create)
+static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
{
- gfs2_assert_warn(inode->i_sb->s_fs_info, 0);
- return -EOPNOTSUPP;
-}
+ int err;
+ struct buffer_head *bh, *head;
+ int nr_underway = 0;
+ int write_op = (1 << BIO_RW_META) | ((wbc->sync_mode == WB_SYNC_ALL ?
+ WRITE_SYNC_PLUG : WRITE));
+
+ BUG_ON(!PageLocked(page));
+ BUG_ON(!page_has_buffers(page));
+
+ head = page_buffers(page);
+ bh = head;
+
+ do {
+ if (!buffer_mapped(bh))
+ continue;
+ /*
+ * If it's a fully non-blocking write attempt and we cannot
+ * lock the buffer then redirty the page. Note that this can
+ * potentially cause a busy-wait loop from pdflush and kswapd
+ * activity, but those code paths have their own higher-level
+ * throttling.
+ */
+ if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) {
+ lock_buffer(bh);
+ } else if (!trylock_buffer(bh)) {
+ redirty_page_for_writepage(wbc, page);
+ continue;
+ }
+ if (test_clear_buffer_dirty(bh)) {
+ mark_buffer_async_write(bh);
+ } else {
+ unlock_buffer(bh);
+ }
+ } while ((bh = bh->b_this_page) != head);
+
+ /*
+ * The page and its buffers are protected by PageWriteback(), so we can
+ * drop the bh refcounts early.
+ */
+ BUG_ON(PageWriteback(page));
+ set_page_writeback(page);
+
+ do {
+ struct buffer_head *next = bh->b_this_page;
+ if (buffer_async_write(bh)) {
+ submit_bh(write_op, bh);
+ nr_underway++;
+ }
+ bh = next;
+ } while (bh != head);
+ unlock_page(page);
-static int gfs2_aspace_writepage(struct page *page,
- struct writeback_control *wbc)
-{
- return block_write_full_page(page, aspace_get_block, wbc);
+ err = 0;
+ if (nr_underway == 0)
+ end_page_writeback(page);
+
+ return err;
}
static const struct address_space_operations aspace_aops = {
--
1.6.0.6
next prev parent reply other threads:[~2009-06-10 8:30 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 8:30 [Cluster-devel] GFS2: Pre-pull patch posting Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 01/24] GFS2: Update the rw flags Steven Whitehouse
2009-06-10 8:30 ` Steven Whitehouse [this message]
2009-06-10 8:30 ` [Cluster-devel] [PATCH 03/24] GFS2: Something nonlinear this way comes! Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 04/24] GFS2: Fix timestamps on write Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 05/24] GFS2: Move journal live test at transaction start Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 06/24] GFS2: Add commit= mount option Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 07/24] GFS2: Remove a couple of unused sysfs entries Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 08/24] GFS2: Umount recovery race fix Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 09/24] GFS2: Update docs Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 10/24] GFS2: Don't warn when delete inode fails on ro filesystem Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 11/24] GFS2: Improve resource group error handling Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 12/24] GFS2: Add a rgrp bitmap full flag Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 13/24] GFS2: Be more aggressive in reclaiming unlinked inodes Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 14/24] GFS2: Clean up some file names Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 15/24] GFS2: Merge mount.c and ops_super.c into super.c Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 16/24] GFS2: Move gfs2_rmdiri into ops_inode.c Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 17/24] GFS2: Move gfs2_readlinki " Steven Whitehouse
2009-06-10 8:30 ` [Cluster-devel] [PATCH 18/24] GFS2: Move gfs2_unlink_ok " Steven Whitehouse
2009-06-10 8:31 ` [Cluster-devel] [PATCH 19/24] GFS2: Remove lockstruct subdir from gfs2 sysfs files Steven Whitehouse
2009-06-10 8:31 ` [Cluster-devel] [PATCH 20/24] GFS2: Remove args " Steven Whitehouse
2009-06-10 8:31 ` [Cluster-devel] [PATCH 21/24] GFS2: smbd proccess hangs with flock() call Steven Whitehouse
2009-06-10 8:31 ` [Cluster-devel] [PATCH 22/24] GFS2: Remove unused variable Steven Whitehouse
2009-06-10 8:31 ` [Cluster-devel] [PATCH 23/24] GFS2: Fix locking issue mounting gfs2meta fs Steven Whitehouse
2009-06-10 8:31 ` [Cluster-devel] [PATCH 24/24] GFS2: Fix cache coherency between truncate and O_DIRECT read Steven Whitehouse
2009-06-10 9:53 ` [Cluster-devel] Re: [PATCH 23/24] GFS2: Fix locking issue mounting gfs2meta fs Christoph Hellwig
2009-06-10 10:06 ` Steven Whitehouse
2009-06-10 10:43 ` [Cluster-devel] GFS2: Merge gfs2_get_sb into gfs2_get_sb_meta Steven Whitehouse
2009-06-10 9:49 ` [Cluster-devel] Re: [PATCH 10/24] GFS2: Don't warn when delete inode fails on ro filesystem Christoph Hellwig
2009-06-10 10:03 ` Steven Whitehouse
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=1244622665-7470-3-git-send-email-swhiteho@redhat.com \
--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 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).