aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/inode.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 45cf03ee1bc2..2e25d698bab0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4156,11 +4156,6 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
4156 return -EINVAL; 4156 return -EINVAL;
4157} 4157}
4158 4158
4159static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock)
4160{
4161 return extent_bmap(mapping, iblock, btrfs_get_extent);
4162}
4163
4164int btrfs_readpage(struct file *file, struct page *page) 4159int btrfs_readpage(struct file *file, struct page *page)
4165{ 4160{
4166 struct extent_io_tree *tree; 4161 struct extent_io_tree *tree;
@@ -4985,13 +4980,24 @@ static struct extent_io_ops btrfs_extent_io_ops = {
4985 .clear_bit_hook = btrfs_clear_bit_hook, 4980 .clear_bit_hook = btrfs_clear_bit_hook,
4986}; 4981};
4987 4982
4983/*
4984 * btrfs doesn't support the bmap operation because swapfiles
4985 * use bmap to make a mapping of extents in the file. They assume
4986 * these extents won't change over the life of the file and they
4987 * use the bmap result to do IO directly to the drive.
4988 *
4989 * the btrfs bmap call would return logical addresses that aren't
4990 * suitable for IO and they also will change frequently as COW
4991 * operations happen. So, swapfile + btrfs == corruption.
4992 *
4993 * For now we're avoiding this by dropping bmap.
4994 */
4988static struct address_space_operations btrfs_aops = { 4995static struct address_space_operations btrfs_aops = {
4989 .readpage = btrfs_readpage, 4996 .readpage = btrfs_readpage,
4990 .writepage = btrfs_writepage, 4997 .writepage = btrfs_writepage,
4991 .writepages = btrfs_writepages, 4998 .writepages = btrfs_writepages,
4992 .readpages = btrfs_readpages, 4999 .readpages = btrfs_readpages,
4993 .sync_page = block_sync_page, 5000 .sync_page = block_sync_page,
4994 .bmap = btrfs_bmap,
4995 .direct_IO = btrfs_direct_IO, 5001 .direct_IO = btrfs_direct_IO,
4996 .invalidatepage = btrfs_invalidatepage, 5002 .invalidatepage = btrfs_invalidatepage,
4997 .releasepage = btrfs_releasepage, 5003 .releasepage = btrfs_releasepage,