aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-22 09:22:11 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:02 -0400
commit38b669880df44cba24ab1b01715b87318d469217 (patch)
tree8141fbc479cbed2eb608bee04ab85846aee435a6 /fs/btrfs/disk-io.c
parentb30757178dad19a0388d958ff9eea66e674d39ed (diff)
Deal with page == NULL in the btrfs_unplug_io_fn
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 7f5aca35494d..19c258d2c7e2 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -911,12 +911,40 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
911 return ret; 911 return ret;
912} 912}
913 913
914/*
915 * this unplugs every device on the box, and it is only used when page
916 * is null
917 */
918static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
919{
920 struct list_head *cur;
921 struct btrfs_device *device;
922 struct btrfs_fs_info *info;
923
924 info = (struct btrfs_fs_info *)bdi->unplug_io_data;
925 list_for_each(cur, &info->fs_devices->devices) {
926 device = list_entry(cur, struct btrfs_device, dev_list);
927 bdi = blk_get_backing_dev_info(device->bdev);
928 if (bdi->unplug_io_fn) {
929 bdi->unplug_io_fn(bdi, page);
930 }
931 }
932}
933
914void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) 934void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
915{ 935{
916 struct inode *inode = page->mapping->host; 936 struct inode *inode;
917 struct extent_map_tree *em_tree; 937 struct extent_map_tree *em_tree;
918 struct extent_map *em; 938 struct extent_map *em;
919 u64 offset = page_offset(page); 939 u64 offset;
940
941 if (!page) {
942 __unplug_io_fn(bdi, page);
943 return;
944 }
945
946 inode = page->mapping->host;
947 offset = page_offset(page);
920 948
921 em_tree = &BTRFS_I(inode)->extent_tree; 949 em_tree = &BTRFS_I(inode)->extent_tree;
922 spin_lock(&em_tree->lock); 950 spin_lock(&em_tree->lock);