projects
/
linux-2.6-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1ee54b0
)
fs/affs/file.c: add support to O_DIRECT
author
Fabian Frederick
<fabf@skynet.be>
Sat, 13 Dec 2014 00:57:52 +0000
(16:57 -0800)
committer
Linus Torvalds
<torvalds@linux-foundation.org>
Sat, 13 Dec 2014 20:42:51 +0000
(12:42 -0800)
Based on ext2_direct_IO
Tested with O_DIRECT file open and sysbench/mariadb with 1% written
queries improvement (update_non_index test) on a volume created with
mkaffs.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/affs/file.c
patch
|
blob
|
blame
|
history
diff --git
a/fs/affs/file.c
b/fs/affs/file.c
index 8e510854f487e979d657cebc30297f4dc7663e5c..05005bd2621ad4b1bad3eb2cd5c3aab8e73c46d5 100644
(file)
--- a/
fs/affs/file.c
+++ b/
fs/affs/file.c
@@
-12,6
+12,7
@@
* affs regular file handling primitives
*/
* affs regular file handling primitives
*/
+#include <linux/aio.h>
#include "affs.h"
#if PAGE_SIZE < 4096
#include "affs.h"
#if PAGE_SIZE < 4096
@@
-392,6
+393,22
@@
static void affs_write_failed(struct address_space *mapping, loff_t to)
}
}
}
}
+static ssize_t
+affs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
+ loff_t offset)
+{
+ struct file *file = iocb->ki_filp;
+ struct address_space *mapping = file->f_mapping;
+ struct inode *inode = mapping->host;
+ size_t count = iov_iter_count(iter);
+ ssize_t ret;
+
+ ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block);
+ if (ret < 0 && (rw & WRITE))
+ affs_write_failed(mapping, offset + count);
+ return ret;
+}
+
static int affs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
static int affs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
@@
-418,6
+435,7
@@
const struct address_space_operations affs_aops = {
.writepage = affs_writepage,
.write_begin = affs_write_begin,
.write_end = generic_write_end,
.writepage = affs_writepage,
.write_begin = affs_write_begin,
.write_end = generic_write_end,
+ .direct_IO = affs_direct_IO,
.bmap = _affs_bmap
};
.bmap = _affs_bmap
};