diff options
author | Chao Yu <yuchao0@huawei.com> | 2020-04-16 13:16:56 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-04-17 19:17:00 +0300 |
commit | 8b83ac81f4283ae3bd05c9a7e15dca721014dd03 (patch) | |
tree | 1ce1a104615ba45fdb9df0a828f4b03d8b4182e4 /fs/f2fs/file.c | |
parent | df423399757531c20d495bf6b8b83a8dcca3565c (diff) | |
download | linux-8b83ac81f4283ae3bd05c9a7e15dca721014dd03.tar.xz |
f2fs: support read iostat
Adds to support accounting read IOs from userspace/kernel.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r-- | fs/f2fs/file.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 6ab8f621a3c5..a0a4413d6083 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -40,6 +40,10 @@ static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf) ret = filemap_fault(vmf); up_read(&F2FS_I(inode)->i_mmap_sem); + if (!ret) + f2fs_update_iostat(F2FS_I_SB(inode), APP_MAPPED_READ_IO, + F2FS_BLKSIZE); + trace_f2fs_filemap_fault(inode, vmf->pgoff, (unsigned long)ret); return ret; @@ -3510,11 +3514,17 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) { struct file *file = iocb->ki_filp; struct inode *inode = file_inode(file); + int ret; if (!f2fs_is_compress_backend_ready(inode)) return -EOPNOTSUPP; - return generic_file_read_iter(iocb, iter); + ret = generic_file_read_iter(iocb, iter); + + if (ret > 0) + f2fs_update_iostat(F2FS_I_SB(inode), APP_READ_IO, ret); + + return ret; } static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) |