3 @@ -70,6 +70,11 @@ config FILE_LOCKING
4 for filesystems like NFS and for the flock() system
5 call. Disabling this option saves about 11k.
8 + bool "Enable O_DIRECT support" if EXPERT
12 source "fs/notify/Kconfig"
14 source "fs/quota/Kconfig"
17 @@ -14,7 +14,8 @@ obj-y := open.o read_write.o file_table.
18 stack.o fs_struct.o statfs.o fs_pin.o nsfs.o
20 ifeq ($(CONFIG_BLOCK),y)
21 -obj-y += buffer.o block_dev.o direct-io.o mpage.o
22 +obj-y += buffer.o block_dev.o mpage.o
23 +obj-$(CONFIG_DIRECT_IO) += direct-io.o
27 --- a/include/linux/fs.h
28 +++ b/include/linux/fs.h
29 @@ -2614,12 +2614,25 @@ enum {
30 DIO_ASYNC_EXTEND = 0x04,
33 +#ifdef CONFIG_DIRECT_IO
34 void dio_end_io(struct bio *bio, int error);
36 ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
37 struct block_device *bdev, struct iov_iter *iter, loff_t offset,
38 get_block_t get_block, dio_iodone_t end_io,
39 dio_submit_t submit_io, int flags);
41 +static inline void dio_end_io(struct bio *bio, int error)
44 +static inline ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
45 + struct block_device *bdev, struct iov_iter *iter, loff_t offset,
46 + get_block_t get_block, dio_iodone_t end_io,
47 + dio_submit_t submit_io, int flags)
53 static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
54 struct inode *inode, struct iov_iter *iter, loff_t offset,
57 @@ -52,8 +52,10 @@ static int setfl(int fd, struct file * f
61 +#ifdef CONFIG_DIRECT_IO
62 if (!filp->f_mapping || !filp->f_mapping->a_ops ||
63 !filp->f_mapping->a_ops->direct_IO)
70 @@ -667,7 +667,9 @@ int open_check_o_direct(struct file *f)
72 /* NB: we're sure to have correct a_ops only after f_op->open */
73 if (f->f_flags & O_DIRECT) {
74 +#ifdef CONFIG_DIRECT_IO
75 if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO)