summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiao Xie2014-03-06 06:54:56 +0100
committerJosef Bacik2014-03-10 20:17:23 +0100
commitaf7a65097b3f0a63caf1755df78d04e1a33588ef (patch)
tree922d96888bc7fd2929e1553f31bd4e51d4e8291e
parentBtrfs: fix early enospc due to the race of the two ordered extent wait (diff)
downloadkernel-qcow2-linux-af7a65097b3f0a63caf1755df78d04e1a33588ef.tar.gz
kernel-qcow2-linux-af7a65097b3f0a63caf1755df78d04e1a33588ef.tar.xz
kernel-qcow2-linux-af7a65097b3f0a63caf1755df78d04e1a33588ef.zip
Btrfs: wake up the tasks that wait for the io earlier
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> Signed-off-by: Josef Bacik <jbacik@fb.com>
-rw-r--r--fs/btrfs/ordered-data.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 73de19c37f5a..a75eaa286b8a 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -349,10 +349,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;
@@ -410,10 +413,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;