Skip to contentSkip to conversation

fat: fallback to buffered write in case of fallocated region on direct IO

PATCH In review Namjae Jeon 1 participant 1 message Mar 2, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 4/6 fat: fallback to buffered write in case of fallocated region on direct IO

From: Namjae Jeon <[email protected]>

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.

---
 fs/fat/inode.c | 7 +++++++
 1 file changed, 7 insertions(+)
fs/fat/inode.c +7 -0
index a594dae..9509d07 100644
@@ -229,6 +229,13 @@ 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 > MSDOS_I(inode)->mmu_private)
+			return 0;
 	}
 
 	/*
Signature · 1 line
1.7.11-rc0