From: Jin Qian Date: Thu, 2 Mar 2017 21:32:59 +0000 (-0800) Subject: ANDROID: fs: sched: add a counter to track fsync X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=605a0bca4900a0e175d7a1e87fec7b23d031982f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ANDROID: fs: sched: add a counter to track fsync Change-Id: I6c138de5b2332eea70f57e098134d1d141247b3f Signed-off-by: Jin Qian [AmitP: Refactored changes to align with changes from upstream commit 9a07000400c8 ("sched/headers: Move CONFIG_TASK_XACCT bits from to ")] Signed-off-by: Amit Pundir --- diff --git a/fs/sync.c b/fs/sync.c index 83ac79a960dd..12f2aa594c50 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -219,6 +219,7 @@ static int do_fsync(unsigned int fd, int datasync) if (f.file) { ret = vfs_fsync(f.file, datasync); fdput(f); + inc_syscfs(current); } return ret; } diff --git a/include/linux/sched/xacct.h b/include/linux/sched/xacct.h index c078f0a94cec..9544c9d9d534 100644 --- a/include/linux/sched/xacct.h +++ b/include/linux/sched/xacct.h @@ -28,6 +28,11 @@ static inline void inc_syscw(struct task_struct *tsk) { tsk->ioac.syscw++; } + +static inline void inc_syscfs(struct task_struct *tsk) +{ + tsk->ioac.syscfs++; +} #else static inline void add_rchar(struct task_struct *tsk, ssize_t amt) { @@ -44,6 +49,10 @@ static inline void inc_syscr(struct task_struct *tsk) static inline void inc_syscw(struct task_struct *tsk) { } + +static inline void inc_syscfs(struct task_struct *tsk) +{ +} #endif #endif /* _LINUX_SCHED_XACCT_H */ diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h index 6f6acce064de..bb26108ca23c 100644 --- a/include/linux/task_io_accounting.h +++ b/include/linux/task_io_accounting.h @@ -19,6 +19,8 @@ struct task_io_accounting { u64 syscr; /* # of write syscalls */ u64 syscw; + /* # of fsync syscalls */ + u64 syscfs; #endif /* CONFIG_TASK_XACCT */ #ifdef CONFIG_TASK_IO_ACCOUNTING diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h index bb5498bcdd96..733ab62ae141 100644 --- a/include/linux/task_io_accounting_ops.h +++ b/include/linux/task_io_accounting_ops.h @@ -97,6 +97,7 @@ static inline void task_chr_io_accounting_add(struct task_io_accounting *dst, dst->wchar += src->wchar; dst->syscr += src->syscr; dst->syscw += src->syscw; + dst->syscfs += src->syscfs; } #else static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,