mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zach Brown <zach.brown@oracle.com>
To: linux-fsdevel@vger.kernel.org, linux-aio@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [RFC 2/5] dio: call blk_run_address_space() once per op
Date: Tue,  5 Sep 2006 16:57:42 -0700 (PDT)	[thread overview]
Message-ID: <20060905235742.29630.24068.sendpatchset@tetsuo.zabbo.net> (raw)
In-Reply-To: <20060905235732.29630.3950.sendpatchset@tetsuo.zabbo.net>

dio: call blk_run_address_space() once per op

We only need to call blk_run_address_space() once after all the bios for the
direct IO op have been submitted.  This removes the chance of calling
blk_run_address_space() after spurious wake ups as the sync path waits for bios
to drain.  It's also one less difference betwen the sync and async paths.

In the process we remove a redundant dio_bio_submit() that its caller had
already performed. 

Signed-off-by: Zach Brown <zach.brown@oracle.com>
---

 fs/direct-io.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Index: 2.6.18-rc6-dio-cleanup/fs/direct-io.c
===================================================================
--- 2.6.18-rc6-dio-cleanup.orig/fs/direct-io.c
+++ 2.6.18-rc6-dio-cleanup/fs/direct-io.c
@@ -403,7 +403,6 @@ static struct bio *dio_await_one(struct 
 		if (dio->bio_list == NULL) {
 			dio->waiter = current;
 			spin_unlock_irqrestore(&dio->bio_lock, flags);
-			blk_run_address_space(dio->inode->i_mapping);
 			io_schedule();
 			spin_lock_irqsave(&dio->bio_lock, flags);
 			dio->waiter = NULL;
@@ -449,9 +448,6 @@ static int dio_bio_complete(struct dio *
  */
 static void dio_await_completion(struct dio *dio)
 {
-	if (dio->bio)
-		dio_bio_submit(dio);
-
 	/*
 	 * The bio_lock is not held for the read of bio_count.
 	 * This is ok since it is the dio_bio_complete() that changes
@@ -1077,6 +1073,9 @@ direct_io_worker(int rw, struct kiocb *i
 	if (dio->bio)
 		dio_bio_submit(dio);
 
+	/* All IO is now issued, send it on its way */
+	blk_run_address_space(inode->i_mapping);
+
 	/*
 	 * It is possible that, we return short IO due to end of file.
 	 * In that case, we need to release all the pages we got hold on.
@@ -1105,7 +1104,6 @@ direct_io_worker(int rw, struct kiocb *i
 		if (ret == 0)
 			ret = dio->result;
 		finished_one_bio(dio);		/* This can free the dio */
-		blk_run_address_space(inode->i_mapping);
 		if (should_wait) {
 			unsigned long flags;
 			/*

  parent reply	other threads:[~2006-09-05 23:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-05 23:57 [RFC 0/5] dio: clean up completion phase of direct_io_worker() Zach Brown
2006-09-05 23:57 ` [RFC 1/5] dio: centralize completion in dio_complete() Zach Brown
2006-09-05 23:57 ` Zach Brown [this message]
2006-09-05 23:57 ` [RFC 3/5] dio: formalize bio counters as a dio reference count Zach Brown
2006-09-05 23:57 ` [RFC 4/5] dio: remove duplicate bio wait code Zach Brown
2006-09-05 23:57 ` [RFC 5/5] dio: only call aio_complete() after returning -EIOCBQUEUED Zach Brown
2006-09-06  4:35 ` bogofilter ate 3/5 Zach Brown
2006-09-06  5:00   ` Willy Tarreau
2006-09-06  7:22   ` Mike Galbraith
2006-09-08 22:16   ` Matthias Andree
2006-09-06  7:36 ` [RFC 0/5] dio: clean up completion phase of direct_io_worker() Suparna Bhattacharya
2006-09-06 16:36   ` Zach Brown
2006-09-06 14:57 ` Jeff Moyer
2006-09-06 16:46   ` Zach Brown
2006-09-06 18:13     ` Jeff Moyer

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=20060905235742.29630.24068.sendpatchset@tetsuo.zabbo.net \
    --to=zach.brown@oracle.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome