Skip to contentSkip to conversation

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

PATCH Superseded Namjae Jeon 2 participants 3 messages Nov 17, 2013 – Dec 5, 2013

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/5 fat: fallback to buffered write in case of fallocatded 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 |    8 ++++++++
 1 file changed, 8 insertions(+)
fs/fat/inode.c +8 -0
index 12a37a9..c9fb9b6 100644
@@ -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;
 	}
 
 	/*
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 6 lines · Namjae Jeon
fs/fat/inode.c +0 -0
index 12a37a9..c9fb9b6 100644
@@ -217,6 +217,14 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
 		loff_t size = offset + iov_iter_count(iter);

fs/fat/inode.c static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, · line 227

Quoted 10 lines
fs/fat/inode.c +8 -0
 		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;

->mmu_private works instead of i_size?

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#2 lore raw

2013/12/1, OGAWA Hirofumi <[email protected]>:

Quoted 13 lines
Quoted 11 lines · Namjae Jeon
fs/fat/inode.c +2 -0
index 12a37a9..c9fb9b6 100644
@@ -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;
+
+		/*
Quoted 8 lines

fs/fat/inode.c static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, · line 227

Quoted 6 lines
fs/fat/inode.c +6 -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;

->mmu_private works instead of i_size?

Yes, I will change it.
Thanks.

Quoted 3 lines

--
OGAWA Hirofumi <[email protected]>