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,


> 
> Signed-off-by: Weichao Guo <[email protected]>
> ---
>  fs/f2fs/data.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 36b5352..039f6d8 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -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
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to