lkml.org 
[lkml]   [2013]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/5] fat: fallback to buffered write in case of fallocatded region on direct IO
Date
From: Namjae Jeon <namjae.jeon@samsung.com>

For normal cases of direct IO write, trying to seek to location greater than file size,
makes it fall back to buffered write to fill that region.
Similarly, in case for write in Fallocated region, make it fall to buffered write.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
---
fs/fat/inode.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 2f2a265..1e71ead 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -217,6 +217,14 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
loff_t size = offset + iov_iter_count(iter);
if (MSDOS_I(inode)->mmu_private < size)
return 0;
+
+ /*
+ * In case of writing in fallocated region, return 0 and
+ * fallback to buffered write.
+ */
+ if (MSDOS_I(inode)->i_disksize >
+ round_up(i_size_read(inode), inode->i_sb->s_blocksize))
+ return 0;
}

/*
--
1.7.9.5


\
 
 \ /
  Last update: 2013-10-09 17:01    [W:0.026 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site