0009-blk-cgroup-always-terminate-io.stat-lines.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 3607849df47822151b05df440759e2dc70160755 Mon Sep 17 00:00:00 2001
  2. From: Wolfgang Bumiller <[email protected]>
  3. Date: Tue, 11 Jan 2022 09:31:59 +0100
  4. Subject: blk-cgroup: always terminate io.stat lines
  5. With the removal of seq_get_buf in blkcg_print_one_stat, we
  6. cannot make adding the newline conditional on there being
  7. relevant stats because the name was already written out
  8. unconditionally.
  9. Otherwise we may end up with multiple device names in one
  10. line which is confusing and doesn't follow the nested-keyed
  11. file format.
  12. Signed-off-by: Wolfgang Bumiller <[email protected]>
  13. Fixes: 252c651a4c85 ("blk-cgroup: stop using seq_get_buf")
  14. Acked-by: Tejun Heo <[email protected]>
  15. Link: https://lore.kernel.org/r/[email protected]
  16. Signed-off-by: Jens Axboe <[email protected]>
  17. ---
  18. block/blk-cgroup.c | 9 ++-------
  19. 1 file changed, 2 insertions(+), 7 deletions(-)
  20. (limited to 'block/blk-cgroup.c')
  21. diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
  22. index a91f8ae18b49b..204442fad33cf 100644
  23. --- a/block/blk-cgroup.c
  24. +++ b/block/blk-cgroup.c
  25. @@ -949,7 +949,6 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
  26. {
  27. struct blkg_iostat_set *bis = &blkg->iostat;
  28. u64 rbytes, wbytes, rios, wios, dbytes, dios;
  29. - bool has_stats = false;
  30. const char *dname;
  31. unsigned seq;
  32. int i;
  33. @@ -975,14 +974,12 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
  34. } while (u64_stats_fetch_retry(&bis->sync, seq));
  35. if (rbytes || wbytes || rios || wios) {
  36. - has_stats = true;
  37. seq_printf(s, "rbytes=%llu wbytes=%llu rios=%llu wios=%llu dbytes=%llu dios=%llu",
  38. rbytes, wbytes, rios, wios,
  39. dbytes, dios);
  40. }
  41. if (blkcg_debug_stats && atomic_read(&blkg->use_delay)) {
  42. - has_stats = true;
  43. seq_printf(s, " use_delay=%d delay_nsec=%llu",
  44. atomic_read(&blkg->use_delay),
  45. atomic64_read(&blkg->delay_nsec));
  46. @@ -994,12 +991,10 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
  47. if (!blkg->pd[i] || !pol->pd_stat_fn)
  48. continue;
  49. - if (pol->pd_stat_fn(blkg->pd[i], s))
  50. - has_stats = true;
  51. + pol->pd_stat_fn(blkg->pd[i], s);
  52. }
  53. - if (has_stats)
  54. - seq_printf(s, "\n");
  55. + seq_puts(s, "\n");
  56. }
  57. static int blkcg_print_stat(struct seq_file *sf, void *v)
  58. --
  59. cgit