linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <mason@suse.com>
From: Chris Mason <mason@suse.com>
To: akpm@osdl.org, linux-fsdevel@vger.kernel.org, reiserfs-list@namesys.com
Subject: [patch 3/6] reiserfs v3 patches
Subject: [patch 3/6] reiserfs hang and performance fix for data=journal mode
Date: Sun, 15 Jan 2006 19:50:05 -0500	[thread overview]
Message-ID: <20060116005312.760818000@watt.suse.com> (raw)
In-Reply-To: 20060116005002.398989000@watt.suse.com

[-- Attachment #1: reiserfs-logging-perf-3 --]
[-- Type: text/plain, Size: 2553 bytes --]

In data=journal mode, reiserfs writepage needs to make sure not to
trigger transactions while being run under PF_MEMALLOC.  This patch
makes sure to redirty the page instead of forcing a transaction start
in this case.

Also, calling filemap_fdata* in order to trigger io on the block device
can cause lock inversions on the page lock.  Instead, do simple
batching from flush_commit_list.

diff -r c10585019f18 fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c	Fri Jan 13 13:51:10 2006 -0500
+++ b/fs/reiserfs/inode.c	Fri Jan 13 13:55:09 2006 -0500
@@ -2363,6 +2363,13 @@ static int reiserfs_write_full_page(stru
 	int bh_per_page = PAGE_CACHE_SIZE / s->s_blocksize;
 	th.t_trans_id = 0;
 
+	/* no logging allowed when nonblocking or from PF_MEMALLOC */
+	if (checked && (current->flags & PF_MEMALLOC)) {
+		redirty_page_for_writepage(wbc, page);
+		unlock_page(page);
+		return 0;
+	}
+
 	/* The page dirty bit is cleared before writepage is called, which
 	 * means we have to tell create_empty_buffers to make dirty buffers
 	 * The page really should be up to date at this point, so tossing
diff -r c10585019f18 fs/reiserfs/journal.c
--- a/fs/reiserfs/journal.c	Fri Jan 13 13:51:10 2006 -0500
+++ b/fs/reiserfs/journal.c	Fri Jan 13 13:55:09 2006 -0500
@@ -990,6 +990,7 @@ static int flush_commit_list(struct supe
 	struct reiserfs_journal *journal = SB_JOURNAL(s);
 	int barrier = 0;
 	int retval = 0;
+	int write_len;
 
 	reiserfs_check_lock_depth(s, "flush_commit_list");
 
@@ -1039,16 +1040,24 @@ static int flush_commit_list(struct supe
 	BUG_ON(!list_empty(&jl->j_bh_list));
 	/*
 	 * for the description block and all the log blocks, submit any buffers
-	 * that haven't already reached the disk
+	 * that haven't already reached the disk.  Try to write at least 256
+	 * log blocks. later on, we will only wait on blocks that correspond
+	 * to this transaction, but while we're unplugging we might as well
+	 * get a chunk of data on there.
 	 */
 	atomic_inc(&journal->j_async_throttle);
-	for (i = 0; i < (jl->j_len + 1); i++) {
+	write_len = jl->j_len + 1;
+	if (write_len < 256)
+		write_len = 256;
+	for (i = 0 ; i < write_len ; i++) {
 		bn = SB_ONDISK_JOURNAL_1st_BLOCK(s) + (jl->j_start + i) %
 		    SB_ONDISK_JOURNAL_SIZE(s);
 		tbh = journal_find_get_block(s, bn);
-		if (buffer_dirty(tbh))	/* redundant, ll_rw_block() checks */
-			ll_rw_block(SWRITE, 1, &tbh);
-		put_bh(tbh);
+		if (tbh) {
+			if (buffer_dirty(tbh))
+			    ll_rw_block(WRITE, 1, &tbh) ;
+			put_bh(tbh) ; 
+		}
 	}
 	atomic_dec(&journal->j_async_throttle);
 

--

  parent reply	other threads:[~2006-01-16  0:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-16  0:50 [patch 0/6] reiserfs v3 patches Chris Mason
2006-01-16  0:50 ` [patch 1/6] reiserfs v3 patches, [patch 1/6] fix reiserfs_invalidatepage race against data=ordered Chris Mason, Chris Mason
2006-01-16  0:50 ` [patch 2/6] reiserfs v3 patches, [patch 2/6] Zero b_private when allocating buffer heads Chris Mason, Chris Mason
2006-01-16  0:50 ` Chris Mason, Chris Mason [this message]
2006-01-16  0:50 ` [patch 4/6] reiserfs v3 patches, [patch 4/6] reiserfs write_ordered_buffers should not oops on dirty non-uptodate bh Chris Mason, Chris Mason
2006-01-16  0:50 ` [patch 5/6] reiserfs v3 patches, [patch 5/6] reiserfs fix journal accounting in journal_transaction_should_end Chris Mason, Chris Mason
2006-01-16  0:50 ` [patch 6/6] reiserfs v3 patches, [patch 6/6] reiserfs: check for files > 2GB on 3.5.x disks Chris Mason, Jeff Mahoney

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=20060116005312.760818000@watt.suse.com \
    --to=mason@suse.com \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=reiserfs-list@namesys.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).