task_io_accounting.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * task_io_accounting: a structure which is used for recording a single task's
  4. * IO statistics.
  5. *
  6. * Don't include this header file directly - it is designed to be dragged in via
  7. * sched.h.
  8. *
  9. * Blame Andrew Morton for all this.
  10. */
  11. struct task_io_accounting {
  12. #ifdef CONFIG_TASK_XACCT
  13. /* bytes read */
  14. u64 rchar;
  15. /* bytes written */
  16. u64 wchar;
  17. /* # of read syscalls */
  18. u64 syscr;
  19. /* # of write syscalls */
  20. u64 syscw;
  21. /* # of fsync syscalls */
  22. u64 syscfs;
  23. #endif /* CONFIG_TASK_XACCT */
  24. #ifdef CONFIG_TASK_IO_ACCOUNTING
  25. /*
  26. * The number of bytes which this task has caused to be read from
  27. * storage.
  28. */
  29. u64 read_bytes;
  30. /*
  31. * The number of bytes which this task has caused, or shall cause to be
  32. * written to disk.
  33. */
  34. u64 write_bytes;
  35. /*
  36. * A task can cause "negative" IO too. If this task truncates some
  37. * dirty pagecache, some IO which another task has been accounted for
  38. * (in its write_bytes) will not be happening. We _could_ just
  39. * subtract that from the truncating task's write_bytes, but there is
  40. * information loss in doing that.
  41. */
  42. u64 cancelled_write_bytes;
  43. #endif /* CONFIG_TASK_IO_ACCOUNTING */
  44. };