f2fs: fix to account IO correctly for cgroup writeback
authorChao Yu <yuchao0@huawei.com>
Mon, 22 Oct 2018 15:24:28 +0000 (23:24 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 26 Oct 2018 18:26:53 +0000 (11:26 -0700)
Now, we have supported cgroup writeback, it depends on correctly IO
account of specified filesystem.

But in commit d1b3e72d5490 ("f2fs: submit bio of in-place-update pages"),
we split write paths from f2fs_submit_page_mbio() to two:
- f2fs_submit_page_bio() for IPU path
- f2fs_submit_page_bio() for OPU path

But still we account write IO only in f2fs_submit_page_mbio(), result in
incorrect IO account, fix it by adding missing IO account in IPU path.

Fixes: d1b3e72d5490 ("f2fs: submit bio of in-place-update pages")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index d67c8a5029147452e2ecc77a15617ef99f5b7b5a..4b1e02b1d302c07555bd39479e6ed302bdfc4a29 100644 (file)
@@ -459,6 +459,10 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
                bio_put(bio);
                return -EFAULT;
        }
+
+       if (fio->io_wbc && !is_read_io(fio->op))
+               wbc_account_io(fio->io_wbc, page, PAGE_SIZE);
+
        bio_set_op_attrs(bio, fio->op, fio->op_flags);
 
        if (!is_read_io(fio->op))