aboutsummaryrefslogtreecommitdiffstats
path: root/fs/affs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/affs')
-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