This is an effort to use iomap for btrfs. This would keep most responsibility of page handling during writes in iomap code, hence code reduction. For CoW support, changes are needed in iomap code to make sure we perform a copy before the write. This is in line with the discussion we had during adding dax support in btrfs. [1] https://github.com/goldwynr/linux/tree/btrfs-iomap -- Goldwyn Changes since v1 - Added Direct I/O support - Remove PagePrivate from btrfs pages for regular files Changes since v2 - Added CONFIG_FS_IOMAP_DEBUG and some checks - Fallback to buffered read in case of short direct reads fs/Kconfig | 3 fs/btrfs/Kconfig | 1 fs/btrfs/Makefile | 2 fs/btrfs/compression.c | 1 fs/btrfs/ctree.h | 15 - fs/btrfs/extent_io.c | 13 fs/btrfs/extent_io.h | 2 fs/btrfs/file.c | 523 +------------------------------------- fs/btrfs/free-space-cache.c | 1 fs/btrfs/inode.c | 170 +++--------- fs/btrfs/ioctl.c | 4 fs/btrfs/iomap.c | 598 +++++++++++++++++++++++++++++++++++++++++++- fs/btrfs/relocation.c | 2 fs/dax.c | 8 fs/ext2/inode.c | 2 fs/ext4/inode.c | 2 fs/gfs2/bmap.c | 3 fs/iomap/apply.c | 5 fs/iomap/buffered-io.c | 37 +- fs/iomap/direct-io.c | 18 - fs/iomap/fiemap.c | 4 fs/iomap/seek.c | 4 fs/iomap/swapfile.c | 3 fs/xfs/xfs_iomap.c | 9 include/linux/fs.h | 2 include/linux/iomap.h | 18 + mm/filemap.c | 13 27 files changed, 757 insertions(+), 706 deletions(-)