Patchwork [3/6] jbd2: yield the device queue when waiting for journal commits

login
register
mail settings
Submitter Jeff Moyer
Date July 2, 2010, 7:58 p.m.
Message ID <1278100699-24132-4-git-send-email-jmoyer@redhat.com>
Download mbox | patch
Permalink /patch/57766/
State New
Headers show

Comments

Jeff Moyer - July 2, 2010, 7:58 p.m.
This patch gets CFQ back in line with deadline for iozone runs, especially
those testing small files + fsync timings.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 fs/jbd2/journal.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Patch

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index bc2ff59..6b5bf0f 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -41,6 +41,7 @@ 
 #include <linux/hash.h>
 #include <linux/log2.h>
 #include <linux/vmalloc.h>
+#include <linux/blkdev.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/jbd2.h>
@@ -192,6 +193,7 @@  loop:
 			should_sleep = 0;
 		if (should_sleep) {
 			spin_unlock(&journal->j_state_lock);
+			blk_yield(journal->j_dev->bd_disk->queue, NULL);
 			schedule();
 			spin_lock(&journal->j_state_lock);
 		}
@@ -580,6 +582,11 @@  int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
 	while (tid_gt(tid, journal->j_commit_sequence)) {
 		jbd_debug(1, "JBD: want %d, j_commit_sequence=%d\n",
 				  tid, journal->j_commit_sequence);
+		/*
+		 * Give up our I/O scheduler time slice to allow the journal
+		 * thread to issue I/O.
+		 */
+		blk_yield(journal->j_dev->bd_disk->queue, journal->j_task);
 		wake_up(&journal->j_wait_commit);
 		spin_unlock(&journal->j_state_lock);
 		wait_event(journal->j_wait_done_commit,