aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2014-12-12 19:57:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 15:42:51 -0500
commit9abb408307008a19be5719bbf1d069bb3ed7aa60 (patch)
treeebd4358e5fdf9561a42c8cec11a6f3b994646948 /fs
parent1ee54b099acecb928bc76ea4beca668697b4a4d0 (diff)
fs/affs/file.c: add support to O_DIRECT
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/affs/file.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 8e510854f487..05005bd2621a 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -12,6 +12,7 @@
12 * affs regular file handling primitives 12 * affs regular file handling primitives
13 */ 13 */
14 14
15#include <linux/aio.h>
15#include "affs.h" 16#include "affs.h"
16 17
17#if PAGE_SIZE < 4096 18#if PAGE_SIZE < 4096
@@ -392,6 +393,22 @@ static void affs_write_failed(struct address_space *mapping, loff_t to)
392 } 393 }
393} 394}
394 395
396static ssize_t
397affs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
398 loff_t offset)
399{
400 struct file *file = iocb->ki_filp;
401 struct address_space *mapping = file->f_mapping;
402 struct inode *inode = mapping->host;
403 size_t count = iov_iter_count(iter);
404 ssize_t ret;
405
406 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block);
407 if (ret < 0 && (rw & WRITE))
408 affs_write_failed(mapping, offset + count);
409 return ret;
410}
411
395static int affs_write_begin(struct file *file, struct address_space *mapping, 412static int affs_write_begin(struct file *file, struct address_space *mapping,
396 loff_t pos, unsigned len, unsigned flags, 413 loff_t pos, unsigned len, unsigned flags,
397 struct page **pagep, void **fsdata) 414 struct page **pagep, void **fsdata)
@@ -418,6 +435,7 @@ const struct address_space_operations affs_aops = {
418 .writepage = affs_writepage, 435 .writepage = affs_writepage,
419 .write_begin = affs_write_begin, 436 .write_begin = affs_write_begin,
420 .write_end = generic_write_end, 437 .write_end = generic_write_end,
438 .direct_IO = affs_direct_IO,
421 .bmap = _affs_bmap 439 .bmap = _affs_bmap
422}; 440};
423 441