aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-14 09:48:18 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:01 -0400
commitb248a4152956cbae1b23f4c70ef5b51d6ea2ecfb (patch)
treed42f7c6520b825e09e0c802d01e66a78297f6eb0 /fs/btrfs/disk-io.c
parent98d20f67cf99ccda638dbcdf7b3a9ee0a428d932 (diff)
Btrfs: A few updates for 2.6.18 and versions older than 2.6.25
This includes fixing a missing spinlock init call that caused oops on mount for most kernels other than 2.6.25. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index aebe8c21ec80..9c94dddde704 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -850,7 +850,9 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
850 850
851static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi) 851static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
852{ 852{
853#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
853 bdi_init(bdi); 854 bdi_init(bdi);
855#endif
854 bdi->ra_pages = default_backing_dev_info.ra_pages * 4; 856 bdi->ra_pages = default_backing_dev_info.ra_pages * 4;
855 bdi->state = 0; 857 bdi->state = 0;
856 bdi->capabilities = default_backing_dev_info.capabilities; 858 bdi->capabilities = default_backing_dev_info.capabilities;
@@ -950,7 +952,7 @@ void btrfs_end_io_csum(struct work_struct *work)
950 bio->bi_end_io = end_io_wq->end_io; 952 bio->bi_end_io = end_io_wq->end_io;
951 kfree(end_io_wq); 953 kfree(end_io_wq);
952#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23) 954#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
953 bio_endio(bio, bio->bi_size, err); 955 bio_endio(bio, bio->bi_size, error);
954#else 956#else
955 bio_endio(bio, error); 957 bio_endio(bio, error);
956#endif 958#endif
@@ -1037,10 +1039,11 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1037 fs_info->btree_inode->i_mapping, GFP_NOFS); 1039 fs_info->btree_inode->i_mapping, GFP_NOFS);
1038 fs_info->do_barriers = 1; 1040 fs_info->do_barriers = 1;
1039 1041
1040 INIT_WORK(&fs_info->end_io_work, btrfs_end_io_csum);
1041#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18) 1042#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
1043 INIT_WORK(&fs_info->end_io_work, btrfs_end_io_csum, fs_info);
1042 INIT_WORK(&fs_info->trans_work, btrfs_transaction_cleaner, fs_info); 1044 INIT_WORK(&fs_info->trans_work, btrfs_transaction_cleaner, fs_info);
1043#else 1045#else
1046 INIT_WORK(&fs_info->end_io_work, btrfs_end_io_csum);
1044 INIT_DELAYED_WORK(&fs_info->trans_work, btrfs_transaction_cleaner); 1047 INIT_DELAYED_WORK(&fs_info->trans_work, btrfs_transaction_cleaner);
1045#endif 1048#endif
1046 BTRFS_I(fs_info->btree_inode)->root = tree_root; 1049 BTRFS_I(fs_info->btree_inode)->root = tree_root;
@@ -1173,7 +1176,9 @@ fail:
1173 close_all_devices(fs_info); 1176 close_all_devices(fs_info);
1174 kfree(extent_root); 1177 kfree(extent_root);
1175 kfree(tree_root); 1178 kfree(tree_root);
1179#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
1176 bdi_destroy(&fs_info->bdi); 1180 bdi_destroy(&fs_info->bdi);
1181#endif
1177 kfree(fs_info); 1182 kfree(fs_info);
1178 return ERR_PTR(err); 1183 return ERR_PTR(err);
1179} 1184}
@@ -1407,7 +1412,10 @@ int close_ctree(struct btrfs_root *root)
1407#endif 1412#endif
1408 close_all_devices(fs_info); 1413 close_all_devices(fs_info);
1409 btrfs_mapping_tree_free(&fs_info->mapping_tree); 1414 btrfs_mapping_tree_free(&fs_info->mapping_tree);
1415
1416#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
1410 bdi_destroy(&fs_info->bdi); 1417 bdi_destroy(&fs_info->bdi);
1418#endif
1411 1419
1412 kfree(fs_info->extent_root); 1420 kfree(fs_info->extent_root);
1413 kfree(fs_info->tree_root); 1421 kfree(fs_info->tree_root);