diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
| -rw-r--r-- | fs/btrfs/disk-io.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index dcaf55695e6f..aa02eab8c40b 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -46,6 +46,10 @@ | |||
| 46 | #include "check-integrity.h" | 46 | #include "check-integrity.h" |
| 47 | #include "rcu-string.h" | 47 | #include "rcu-string.h" |
| 48 | 48 | ||
| 49 | #ifdef CONFIG_X86 | ||
| 50 | #include <asm/cpufeature.h> | ||
| 51 | #endif | ||
| 52 | |||
| 49 | static struct extent_io_ops btree_extent_io_ops; | 53 | static struct extent_io_ops btree_extent_io_ops; |
| 50 | static void end_workqueue_fn(struct btrfs_work *work); | 54 | static void end_workqueue_fn(struct btrfs_work *work); |
| 51 | static void free_fs_root(struct btrfs_root *root); | 55 | static void free_fs_root(struct btrfs_root *root); |
| @@ -859,10 +863,22 @@ static int __btree_submit_bio_done(struct inode *inode, int rw, struct bio *bio, | |||
| 859 | return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, mirror_num, 1); | 863 | return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, mirror_num, 1); |
| 860 | } | 864 | } |
| 861 | 865 | ||
| 866 | static int check_async_write(struct inode *inode, unsigned long bio_flags) | ||
| 867 | { | ||
| 868 | if (bio_flags & EXTENT_BIO_TREE_LOG) | ||
| 869 | return 0; | ||
| 870 | #ifdef CONFIG_X86 | ||
| 871 | if (cpu_has_xmm4_2) | ||
| 872 | return 0; | ||
| 873 | #endif | ||
| 874 | return 1; | ||
| 875 | } | ||
| 876 | |||
| 862 | static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | 877 | static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, |
| 863 | int mirror_num, unsigned long bio_flags, | 878 | int mirror_num, unsigned long bio_flags, |
| 864 | u64 bio_offset) | 879 | u64 bio_offset) |
| 865 | { | 880 | { |
| 881 | int async = check_async_write(inode, bio_flags); | ||
| 866 | int ret; | 882 | int ret; |
| 867 | 883 | ||
| 868 | if (!(rw & REQ_WRITE)) { | 884 | if (!(rw & REQ_WRITE)) { |
| @@ -877,6 +893,12 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
| 877 | return ret; | 893 | return ret; |
| 878 | return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, | 894 | return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, |
| 879 | mirror_num, 0); | 895 | mirror_num, 0); |
| 896 | } else if (!async) { | ||
| 897 | ret = btree_csum_one_bio(bio); | ||
| 898 | if (ret) | ||
| 899 | return ret; | ||
| 900 | return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, | ||
| 901 | mirror_num, 0); | ||
| 880 | } | 902 | } |
| 881 | 903 | ||
| 882 | /* | 904 | /* |
