Skip to contentSkip to conversation

f2fs: direct I/O -> buffered I/O for FI_NO_PREALLOC & FI_INLINE_DATA

PATCH Chao Yu 2 participants 2 messages Sep 28, 2017 – Sep 29, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Chao Yu

author
#1 lore raw
Quoted 5 lines · On 2017/9/29 5:47, [email protected] wrote:

From: Weichao Guo <[email protected]>

In FI_NO_PREALLOC cases, direct I/O path may allocate blocks for an inode but keep its inline data flag. This inconsistency may trigger vfs clear_inode nrpages bug_on when evicting the inode. Let buffered I/O handle this case.

Good catch!

Could we just convert inline data by force in f2fs_preallocate_blocks for this case? it can avoid write fallback from direct IO to buffered IO.

Thanks,

Quoted 12 lines
---
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/data.c +0 -0
index 36b5352..039f6d8 100644

fs/f2fs/data.c static int __allocate_data_block(struct dnode_of_data *dn) · line 828

Quoted 8 lines
fs/f2fs/data.c +1 -1
@@ -822,7 +822,7 @@ static int __allocate_data_block(struct dnode_of_data *dn)
 
 static inline bool __force_buffered_io(struct inode *inode, int rw)
 {
-	return (f2fs_encrypted_file(inode) ||
+	return (f2fs_encrypted_file(inode) || f2fs_has_inline_data(inode) ||
 			(rw == WRITE && test_opt(F2FS_I_SB(inode), LFS)) ||
 			F2FS_I_SB(inode)->s_ndevs);
 }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#2 lore raw

Sure, I will prepare another patch to fix this case.

Quoted 27 lines · Chao Yu
Quoted 5 lines · On 2017/9/29 5:47, [email protected] wrote:

From: Weichao Guo <[email protected]>

In FI_NO_PREALLOC cases, direct I/O path may allocate blocks for an inode but keep its inline data flag. This inconsistency may trigger vfs clear_inode nrpages bug_on when evicting the inode. Let buffered I/O handle this case.

Good catch!

Could we just convert inline data by force in f2fs_preallocate_blocks for this case? it can avoid write fallback from direct IO to buffered IO.

Thanks,

Quoted 12 lines
---
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/data.c +0 -0
index 36b5352..039f6d8 100644
@@ -822,7 +822,7 @@ static int __allocate_data_block(struct dnode_of_data *dn)
 
Quoted 11 lines

fs/f2fs/data.c static int __allocate_data_block(struct dnode_of_data *dn) · line 828

Quoted 8 lines
fs/f2fs/data.c +1 -1
 static inline bool __force_buffered_io(struct inode *inode, int rw)
 {
-	return (f2fs_encrypted_file(inode) ||
+	return (f2fs_encrypted_file(inode) || f2fs_has_inline_data(inode) ||
 			(rw == WRITE && test_opt(F2FS_I_SB(inode), LFS)) ||
 			F2FS_I_SB(inode)->s_ndevs);
 }

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot