Commit 630d565d authored by Youling Tang's avatar Youling Tang Committed by Kent Overstreet

bcachefs: Use filemap_read() to simplify the execution flow

Using filemap_read() can reduce unnecessary code execution
for non IOCB_DIRECT paths.
Signed-off-by: default avatarYouling Tang <tangyouling@kylinos.cn>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent da6fa380
...@@ -179,7 +179,7 @@ ssize_t bch2_read_iter(struct kiocb *iocb, struct iov_iter *iter) ...@@ -179,7 +179,7 @@ ssize_t bch2_read_iter(struct kiocb *iocb, struct iov_iter *iter)
struct bch_inode_info *inode = file_bch_inode(file); struct bch_inode_info *inode = file_bch_inode(file);
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
size_t count = iov_iter_count(iter); size_t count = iov_iter_count(iter);
ssize_t ret; ssize_t ret = 0;
if (!count) if (!count)
return 0; /* skip atime */ return 0; /* skip atime */
...@@ -205,7 +205,7 @@ ssize_t bch2_read_iter(struct kiocb *iocb, struct iov_iter *iter) ...@@ -205,7 +205,7 @@ ssize_t bch2_read_iter(struct kiocb *iocb, struct iov_iter *iter)
iocb->ki_pos += ret; iocb->ki_pos += ret;
} else { } else {
bch2_pagecache_add_get(inode); bch2_pagecache_add_get(inode);
ret = generic_file_read_iter(iocb, iter); ret = filemap_read(iocb, iter, ret);
bch2_pagecache_add_put(inode); bch2_pagecache_add_put(inode);
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment