]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fat: fallback to buffered write in case of fallocatded region on direct IO
authorNamjae Jeon <namjae.jeon@samsung.com>
Fri, 3 Jan 2014 03:10:25 +0000 (14:10 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 3 Jan 2014 03:10:25 +0000 (14:10 +1100)
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>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/fat/inode.c

index 7a547ee0d567906d0b57e5cf67417d5a3370ef8d..ffa2eccc62a2a522bed1ede8531b75fa01487f12 100644 (file)
@@ -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;
        }
 
        /*