diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-10 13:08:31 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-10 13:08:31 -0500 |
commit | 240d5d482b69415b92ffce4b8dfca10799c9890b (patch) | |
tree | 16320929e2220a7859d187bf4eda3810d2886bf2 /fs | |
parent | b47eda8690a10f4fc01eb7b795078fa3fa57149f (diff) |
Btrfs: tune btrfs unplug functions for a small number of devices
When btrfs unplugs, it tries to find the correct device to unplug
via search through the extent_map tree. This avoids unplugging
a device that doesn't need it, but is a waste of time for filesystems
with a small number of devices.
This patch checks the total number of devices before doing the
search.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8efc123d222b..1bb54d69fbb2 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1201,6 +1201,16 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) | |||
1201 | return; | 1201 | return; |
1202 | 1202 | ||
1203 | inode = mapping->host; | 1203 | inode = mapping->host; |
1204 | |||
1205 | /* | ||
1206 | * don't do the expensive searching for a small number of | ||
1207 | * devices | ||
1208 | */ | ||
1209 | if (BTRFS_I(inode)->root->fs_info->fs_devices->open_devices <= 2) { | ||
1210 | __unplug_io_fn(bdi, page); | ||
1211 | return; | ||
1212 | } | ||
1213 | |||
1204 | offset = page_offset(page); | 1214 | offset = page_offset(page); |
1205 | 1215 | ||
1206 | em_tree = &BTRFS_I(inode)->extent_tree; | 1216 | em_tree = &BTRFS_I(inode)->extent_tree; |