diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-03-06 00:54:56 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2014-03-10 15:17:23 -0400 |
commit | af7a65097b3f0a63caf1755df78d04e1a33588ef (patch) | |
tree | 922d96888bc7fd2929e1553f31bd4e51d4e8291e /fs/btrfs/ordered-data.c | |
parent | 8b9d83cd6bebe10e9965d2cef8053b02663eaad8 (diff) |
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>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r-- | fs/btrfs/ordered-data.c | 14 |
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, | |||
349 | if (!uptodate) | 349 | if (!uptodate) |
350 | set_bit(BTRFS_ORDERED_IOERR, &entry->flags); | 350 | set_bit(BTRFS_ORDERED_IOERR, &entry->flags); |
351 | 351 | ||
352 | if (entry->bytes_left == 0) | 352 | if (entry->bytes_left == 0) { |
353 | ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags); | 353 | ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags); |
354 | else | 354 | if (waitqueue_active(&entry->wait)) |
355 | wake_up(&entry->wait); | ||
356 | } else { | ||
355 | ret = 1; | 357 | ret = 1; |
358 | } | ||
356 | out: | 359 | out: |
357 | if (!ret && cached && entry) { | 360 | if (!ret && cached && entry) { |
358 | *cached = entry; | 361 | *cached = entry; |
@@ -410,10 +413,13 @@ have_entry: | |||
410 | if (!uptodate) | 413 | if (!uptodate) |
411 | set_bit(BTRFS_ORDERED_IOERR, &entry->flags); | 414 | set_bit(BTRFS_ORDERED_IOERR, &entry->flags); |
412 | 415 | ||
413 | if (entry->bytes_left == 0) | 416 | if (entry->bytes_left == 0) { |
414 | ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags); | 417 | ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags); |
415 | else | 418 | if (waitqueue_active(&entry->wait)) |
419 | wake_up(&entry->wait); | ||
420 | } else { | ||
416 | ret = 1; | 421 | ret = 1; |
422 | } | ||
417 | out: | 423 | out: |
418 | if (!ret && cached && entry) { | 424 | if (!ret && cached && entry) { |
419 | *cached = entry; | 425 | *cached = entry; |