This is an effort to use iomap for direct I/O in btrfs. This would change the call from __blockdev_direct_io() to iomap_dio_rw(). The main objective is to lose the buffer head and use bio defined by iomap code, and hopefully to use more of generic-FS codebase. I have tested it against xfstests. The performance seems to be nearly the same on my VMs. -- Goldwyn fs/btrfs/ctree.h | 1 fs/btrfs/extent_io.c | 8 ++- fs/btrfs/file.c | 67 +++++++++++++++++++++++++- fs/btrfs/inode.c | 128 +++++++++++++++++++++----------------------------- fs/iomap/direct-io.c | 14 +++-- include/linux/fs.h | 2 include/linux/iomap.h | 2 mm/filemap.c | 13 ++--- 8 files changed, 147 insertions(+), 88 deletions(-)