Skip to content

Commit 3bf1bab

Browse files
yohanjoungJaegeuk Kim
authored andcommitted
f2fs: zone: wait for inflight dio completion, excluding pinned files read using dio
read for the pinfile using Direct I/O do not wait for dio write. Signed-off-by: yohan.joung <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent e6d5e78 commit 3bf1bab

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/f2fs/file.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4834,6 +4834,7 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
48344834
struct inode *inode = file_inode(iocb->ki_filp);
48354835
const loff_t pos = iocb->ki_pos;
48364836
ssize_t ret;
4837+
bool dio;
48374838

48384839
if (!f2fs_is_compress_backend_ready(inode))
48394840
return -EOPNOTSUPP;
@@ -4842,12 +4843,15 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
48424843
f2fs_trace_rw_file_path(iocb->ki_filp, iocb->ki_pos,
48434844
iov_iter_count(to), READ);
48444845

4846+
dio = f2fs_should_use_dio(inode, iocb, to);
4847+
48454848
/* In LFS mode, if there is inflight dio, wait for its completion */
48464849
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))
48484852
inode_dio_wait(inode);
48494853

4850-
if (f2fs_should_use_dio(inode, iocb, to)) {
4854+
if (dio) {
48514855
ret = f2fs_dio_read_iter(iocb, to);
48524856
} else {
48534857
ret = filemap_read(iocb, to, 0);

0 commit comments

Comments
 (0)