linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] Btrfs: wake up the tasks that wait for the io earlier
@ 2013-11-21 13:43 Miao Xie
  2013-11-21 13:43 ` [PATCH 2/5] Btrfs: just do diry page flush for the inode with compression before direct IO Miao Xie
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Miao Xie @ 2013-11-21 13:43 UTC (permalink / raw)
  To: linux-btrfs

The tasks that wait for the IO_DONE flag just care about the io of the dirty
pages, so it is better to wake up them immediately after all the pages are
written, not the whole process of the io completes.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/ordered-data.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index eb5bac4..1bd7002 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -348,10 +348,13 @@ int btrfs_dec_test_first_ordered_pending(struct inode *inode,
 	if (!uptodate)
 		set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
 
-	if (entry->bytes_left == 0)
+	if (entry->bytes_left == 0) {
 		ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
-	else
+		if (waitqueue_active(&entry->wait))
+			wake_up(&entry->wait);
+	} else {
 		ret = 1;
+	}
 out:
 	if (!ret && cached && entry) {
 		*cached = entry;
@@ -408,10 +411,13 @@ have_entry:
 	if (!uptodate)
 		set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
 
-	if (entry->bytes_left == 0)
+	if (entry->bytes_left == 0) {
 		ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
-	else
+		if (waitqueue_active(&entry->wait))
+			wake_up(&entry->wait);
+	} else {
 		ret = 1;
+	}
 out:
 	if (!ret && cached && entry) {
 		*cached = entry;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-11-22 17:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21 13:43 [PATCH 1/5] Btrfs: wake up the tasks that wait for the io earlier Miao Xie
2013-11-21 13:43 ` [PATCH 2/5] Btrfs: just do diry page flush for the inode with compression before direct IO Miao Xie
2013-11-21 13:43 ` [PATCH 3/5] Btrfs: remove the unnecessary flush when preparing the pages Miao Xie
2013-11-21 13:43 ` [PATCH 4/5] Btrfs: remove unnecessary lock in may_commit_transaction() Miao Xie
2013-11-21 13:43 ` [PATCH 5/5] Btrfs: reclaim the reserved metadata space at background Miao Xie
2013-11-22 17:48   ` Josef Bacik
2013-11-22  4:30 ` [PATCH 1/5] Btrfs: wake up the tasks that wait for the io earlier Liu Bo
2013-11-22  7:28   ` Miao Xie
2013-11-22  8:47     ` Liu Bo

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).