diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8adfe059ab41..288c2cdc7543 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/statfs.h> | 34 | #include <linux/statfs.h> |
35 | #include <linux/compat.h> | 35 | #include <linux/compat.h> |
36 | #include <linux/bit_spinlock.h> | 36 | #include <linux/bit_spinlock.h> |
37 | #include <linux/version.h> | ||
38 | #include <linux/xattr.h> | 37 | #include <linux/xattr.h> |
39 | #include <linux/posix_acl.h> | 38 | #include <linux/posix_acl.h> |
40 | #include <linux/falloc.h> | 39 | #include <linux/falloc.h> |
@@ -1324,12 +1323,11 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans, | |||
1324 | struct inode *inode, u64 file_offset, | 1323 | struct inode *inode, u64 file_offset, |
1325 | struct list_head *list) | 1324 | struct list_head *list) |
1326 | { | 1325 | { |
1327 | struct list_head *cur; | ||
1328 | struct btrfs_ordered_sum *sum; | 1326 | struct btrfs_ordered_sum *sum; |
1329 | 1327 | ||
1330 | btrfs_set_trans_block_group(trans, inode); | 1328 | btrfs_set_trans_block_group(trans, inode); |
1331 | list_for_each(cur, list) { | 1329 | |
1332 | sum = list_entry(cur, struct btrfs_ordered_sum, list); | 1330 | list_for_each_entry(sum, list, list) { |
1333 | btrfs_csum_file_blocks(trans, | 1331 | btrfs_csum_file_blocks(trans, |
1334 | BTRFS_I(inode)->root->fs_info->csum_root, sum); | 1332 | BTRFS_I(inode)->root->fs_info->csum_root, sum); |
1335 | } | 1333 | } |
@@ -4158,9 +4156,10 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
4158 | return -EINVAL; | 4156 | return -EINVAL; |
4159 | } | 4157 | } |
4160 | 4158 | ||
4161 | static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock) | 4159 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
4160 | __u64 start, __u64 len) | ||
4162 | { | 4161 | { |
4163 | return extent_bmap(mapping, iblock, btrfs_get_extent); | 4162 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent); |
4164 | } | 4163 | } |
4165 | 4164 | ||
4166 | int btrfs_readpage(struct file *file, struct page *page) | 4165 | int btrfs_readpage(struct file *file, struct page *page) |
@@ -4987,13 +4986,24 @@ static struct extent_io_ops btrfs_extent_io_ops = { | |||
4987 | .clear_bit_hook = btrfs_clear_bit_hook, | 4986 | .clear_bit_hook = btrfs_clear_bit_hook, |
4988 | }; | 4987 | }; |
4989 | 4988 | ||
4989 | /* | ||
4990 | * btrfs doesn't support the bmap operation because swapfiles | ||
4991 | * use bmap to make a mapping of extents in the file. They assume | ||
4992 | * these extents won't change over the life of the file and they | ||
4993 | * use the bmap result to do IO directly to the drive. | ||
4994 | * | ||
4995 | * the btrfs bmap call would return logical addresses that aren't | ||
4996 | * suitable for IO and they also will change frequently as COW | ||
4997 | * operations happen. So, swapfile + btrfs == corruption. | ||
4998 | * | ||
4999 | * For now we're avoiding this by dropping bmap. | ||
5000 | */ | ||
4990 | static struct address_space_operations btrfs_aops = { | 5001 | static struct address_space_operations btrfs_aops = { |
4991 | .readpage = btrfs_readpage, | 5002 | .readpage = btrfs_readpage, |
4992 | .writepage = btrfs_writepage, | 5003 | .writepage = btrfs_writepage, |
4993 | .writepages = btrfs_writepages, | 5004 | .writepages = btrfs_writepages, |
4994 | .readpages = btrfs_readpages, | 5005 | .readpages = btrfs_readpages, |
4995 | .sync_page = block_sync_page, | 5006 | .sync_page = block_sync_page, |
4996 | .bmap = btrfs_bmap, | ||
4997 | .direct_IO = btrfs_direct_IO, | 5007 | .direct_IO = btrfs_direct_IO, |
4998 | .invalidatepage = btrfs_invalidatepage, | 5008 | .invalidatepage = btrfs_invalidatepage, |
4999 | .releasepage = btrfs_releasepage, | 5009 | .releasepage = btrfs_releasepage, |
@@ -5017,6 +5027,7 @@ static struct inode_operations btrfs_file_inode_operations = { | |||
5017 | .removexattr = btrfs_removexattr, | 5027 | .removexattr = btrfs_removexattr, |
5018 | .permission = btrfs_permission, | 5028 | .permission = btrfs_permission, |
5019 | .fallocate = btrfs_fallocate, | 5029 | .fallocate = btrfs_fallocate, |
5030 | .fiemap = btrfs_fiemap, | ||
5020 | }; | 5031 | }; |
5021 | static struct inode_operations btrfs_special_inode_operations = { | 5032 | static struct inode_operations btrfs_special_inode_operations = { |
5022 | .getattr = btrfs_getattr, | 5033 | .getattr = btrfs_getattr, |