mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
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>
This commit is contained in:
parent
8b9d83cd6b
commit
af7a65097b
1 changed files with 10 additions and 4 deletions
|
@ -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 @@ int btrfs_dec_test_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;
|
||||
|
|
Loading…
Reference in a new issue