]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fat: fallback to buffered write in case of fallocated region on direct IO
authorNamjae Jeon <namjae.jeon@samsung.com>
Sat, 17 May 2014 13:19:31 +0000 (23:19 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 May 2014 07:11:40 +0000 (17:11 +1000)
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 37f907168799e9e52483ef33b15a0049fbdfcfb9..6035d6bf9ceac091d9d5129815ae35ace9621703 100644 (file)
@@ -292,6 +292,13 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
                loff_t size = offset + count;
                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 > MSDOS_I(inode)->mmu_private)
+                       return 0;
        }
 
        /*