File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -4834,6 +4834,7 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
4834
4834
struct inode * inode = file_inode (iocb -> ki_filp );
4835
4835
const loff_t pos = iocb -> ki_pos ;
4836
4836
ssize_t ret ;
4837
+ bool dio ;
4837
4838
4838
4839
if (!f2fs_is_compress_backend_ready (inode ))
4839
4840
return - EOPNOTSUPP ;
@@ -4842,12 +4843,15 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
4842
4843
f2fs_trace_rw_file_path (iocb -> ki_filp , iocb -> ki_pos ,
4843
4844
iov_iter_count (to ), READ );
4844
4845
4846
+ dio = f2fs_should_use_dio (inode , iocb , to );
4847
+
4845
4848
/* In LFS mode, if there is inflight dio, wait for its completion */
4846
4849
if (f2fs_lfs_mode (F2FS_I_SB (inode )) &&
4847
- get_pages (F2FS_I_SB (inode ), F2FS_DIO_WRITE ))
4850
+ get_pages (F2FS_I_SB (inode ), F2FS_DIO_WRITE ) &&
4851
+ (!f2fs_is_pinned_file (inode ) || !dio ))
4848
4852
inode_dio_wait (inode );
4849
4853
4850
- if (f2fs_should_use_dio ( inode , iocb , to ) ) {
4854
+ if (dio ) {
4851
4855
ret = f2fs_dio_read_iter (iocb , to );
4852
4856
} else {
4853
4857
ret = filemap_read (iocb , to , 0 );
You can’t perform that action at this time.
0 commit comments