aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-21 10:03:05 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:02 -0400
commitf2d8d74d7874f8f81222363cd6459a365796e35a (patch)
tree2d081c85d9e88006f084cc17fc1ffa262b885e37 /fs/btrfs/disk-io.c
parent4ef64eae288a3644d1f8b748eb075426701e96d1 (diff)
Btrfs: Make an unplug function that doesn't unplug every spindle
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c829612c797e..7f5aca35494d 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -913,18 +913,22 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
913 913
914void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) 914void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
915{ 915{
916 struct list_head *cur; 916 struct inode *inode = page->mapping->host;
917 struct btrfs_device *device; 917 struct extent_map_tree *em_tree;
918 struct btrfs_fs_info *info; 918 struct extent_map *em;
919 u64 offset = page_offset(page);
919 920
920 info = (struct btrfs_fs_info *)bdi->unplug_io_data; 921 em_tree = &BTRFS_I(inode)->extent_tree;
921 list_for_each(cur, &info->fs_devices->devices) { 922 spin_lock(&em_tree->lock);
922 device = list_entry(cur, struct btrfs_device, dev_list); 923 em = lookup_extent_mapping(em_tree, offset, PAGE_CACHE_SIZE);
923 bdi = blk_get_backing_dev_info(device->bdev); 924 spin_unlock(&em_tree->lock);
924 if (bdi->unplug_io_fn) { 925 if (!em)
925 bdi->unplug_io_fn(bdi, page); 926 return;
926 } 927
927 } 928 offset = offset - em->start;
929 btrfs_unplug_page(&BTRFS_I(inode)->root->fs_info->mapping_tree,
930 em->block_start + offset, page);
931 free_extent_map(em);
928} 932}
929 933
930static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi) 934static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)