Skip to content

Commit

Permalink
Btrfs: tune btrfs unplug functions for a small number of devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Mason committed Nov 10, 2008
1 parent b47eda8 commit 240d5d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,16 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
return;

inode = mapping->host;

/*
* don't do the expensive searching for a small number of
* devices
*/
if (BTRFS_I(inode)->root->fs_info->fs_devices->open_devices <= 2) {
__unplug_io_fn(bdi, page);
return;
}

offset = page_offset(page);

em_tree = &BTRFS_I(inode)->extent_tree;
Expand Down

0 comments on commit 240d5d4

Please sign in to comment.