From: Namjae Jeon Date: Fri, 3 Jan 2014 03:10:25 +0000 (+1100) Subject: fat: fallback to buffered write in case of fallocatded region on direct IO X-Git-Tag: next-20140106~2^2~51 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d8feeea359a9b5e06e099f8955bc0390d696e6de;p=karo-tx-linux.git fat: fallback to buffered write in case of fallocatded region on direct IO 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 Signed-off-by: Amit Sahrawat Cc: OGAWA Hirofumi Signed-off-by: Andrew Morton --- diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 7a547ee0d567..ffa2eccc62a2 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -218,6 +218,14 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, loff_t size = offset + iov_length(iov, nr_segs); 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; } /*