This is my still-working-on-it code for btrfs directIO read.
I''m posting it so people can see the progress being made on
the project and can take an early shot at telling me this is
just a bad idea and I''m crazy if they want to, or point out
where I made some stupid mistake with btrfs core functions.
The code is not complete and *NOT* ready for review or testing.
I looked at fs/direct-io.c and the existing btrfs cached-io
routines for a long time and decided I could just not make the
special features of btrfs work well through the common dio code.
My design places all btrfs directIO inside btrfs below the
vfs layer. Note that my current code is based on the .31
address_space_operations, which Jens is changing. To avoid
conflicts, I might hook at the file_operations .aio_read which
may make more sense anyway if btrfs is doing its own thing.
Aside from being completely inside btrfs, the unique part of
this design is it is extent based and all the flow is done to
optimize for the way I think btrfs handles extents.
-- what seems to work now (under ideal conditions) ---
* 1 simple disk volume
* synchronous reads of uncompressed data extents
* synchronous reads of uncompressed inline data
* sparse files
-- what is in the code but completely untested ---
* multiple disks (btrfs raid)
* AIO
-- what I intend to do next (in order) ---
1. compressed data
2. checksum validation
3. load-spreading on multiple copies
4. retry on error with multiple copies
5. cleanup/refactor
As I find things don''t work as I thought, I''m making many code
changes so expect ugly and inconsistent until I finish it all.
A final warning that I have not run any of the test suites
I would normally run before sending code like this out. So
trying it could produce hard-hangs or filesystem corruption.
jim
[PATCH] small changes to existing files to add direct IO read
---
fs/btrfs/Makefile | 2 +-
fs/btrfs/inode.c | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index a35eb36..5cbe798 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -7,4 +7,4 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o
root-tree.o dir-item.o \
extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o \
extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
export.o tree-log.o acl.o free-space-cache.o zlib.o \
- compression.o delayed-ref.o relocation.o
+ compression.o delayed-ref.o relocation.o dio.o
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 272b9b2..835bde3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4308,12 +4308,9 @@ out:
return em;
}
-static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
+extern ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t offset,
- unsigned long nr_segs)
-{
- return -EINVAL;
-}
+ unsigned long nr_segs);
static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info
*fieinfo,
__u64 start, __u64 len)
--
1.5.6.3
======================fs/btrfs/dio.c attached
=======================