diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-08-28 06:15:24 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:07 -0400 |
commit | 9473f16c75606fe6b2e5000525fe9766114505f3 (patch) | |
tree | 93080f8a9bcf59170ce9b56b7e8b03fb4bfed8d9 /fs/btrfs/disk-io.c | |
parent | f3f9931e3d0836509cfccdf473b34e34543a3272 (diff) |
Btrfs: Throttle for async bio submits higher up the chain
The current code waits for the count of async bio submits to get below
a given threshold if it is too high right after adding the latest bio
to the work queue. This isn't optimal because the caller may have
sequential adjacent bios pending they are waiting to send down the pipe.
This changeset requires the caller to wait on the async bio count,
and changes the async checksumming submits to wait for async bios any
time they self throttle.
The end result is much higher sequential throughput.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index bbba14b629d2..6a218f792e59 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -487,9 +487,15 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
487 | atomic_inc(&fs_info->nr_async_submits); | 487 | atomic_inc(&fs_info->nr_async_submits); |
488 | btrfs_queue_worker(&fs_info->workers, &async->work); | 488 | btrfs_queue_worker(&fs_info->workers, &async->work); |
489 | 489 | ||
490 | wait_event_timeout(fs_info->async_submit_wait, | 490 | if (atomic_read(&fs_info->nr_async_submits) > limit) { |
491 | wait_event_timeout(fs_info->async_submit_wait, | ||
491 | (atomic_read(&fs_info->nr_async_submits) < limit), | 492 | (atomic_read(&fs_info->nr_async_submits) < limit), |
492 | HZ/10); | 493 | HZ/10); |
494 | |||
495 | wait_event_timeout(fs_info->async_submit_wait, | ||
496 | (atomic_read(&fs_info->nr_async_bios) < limit), | ||
497 | HZ/10); | ||
498 | } | ||
493 | return 0; | 499 | return 0; |
494 | } | 500 | } |
495 | 501 | ||