From: Chris Mason Date: Mon, 10 Nov 2008 18:08:31 +0000 (-0500) Subject: Btrfs: tune btrfs unplug functions for a small number of devices X-Git-Tag: v2.6.29-rc1~27^2~9^2~55^2~25 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=240d5d482b69415b92ffce4b8dfca10799c9890b;p=linux-2.6-omap-h63xx.git 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 --- diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8efc123d222..1bb54d69fbb 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) 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;