mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
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 <yohan.joung@sk.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
e6d5e789c3
commit
3bf1bab503
|
|
@ -4834,6 +4834,7 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
|||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
const loff_t pos = iocb->ki_pos;
|
||||
ssize_t ret;
|
||||
bool dio;
|
||||
|
||||
if (!f2fs_is_compress_backend_ready(inode))
|
||||
return -EOPNOTSUPP;
|
||||
|
|
@ -4842,12 +4843,15 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
|||
f2fs_trace_rw_file_path(iocb->ki_filp, iocb->ki_pos,
|
||||
iov_iter_count(to), READ);
|
||||
|
||||
dio = f2fs_should_use_dio(inode, iocb, to);
|
||||
|
||||
/* In LFS mode, if there is inflight dio, wait for its completion */
|
||||
if (f2fs_lfs_mode(F2FS_I_SB(inode)) &&
|
||||
get_pages(F2FS_I_SB(inode), F2FS_DIO_WRITE))
|
||||
get_pages(F2FS_I_SB(inode), F2FS_DIO_WRITE) &&
|
||||
(!f2fs_is_pinned_file(inode) || !dio))
|
||||
inode_dio_wait(inode);
|
||||
|
||||
if (f2fs_should_use_dio(inode, iocb, to)) {
|
||||
if (dio) {
|
||||
ret = f2fs_dio_read_iter(iocb, to);
|
||||
} else {
|
||||
ret = filemap_read(iocb, to, 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user