ocfs2-tools/bug-1203166-dump_fs_locks-support-v4.patch
heming zhao 0387c9fea1 Accepting request 1001670 from home:hmzhao:branches:network:ha-clustering:Factory
- enable defragfs.ocfs2 and honor upstream patch dump_fs_locks support v4 (bsc#1203166)
  + modify ocfs2_tools.spec to enable defragfs
  + bug-1203166-dump_fs_locks-support-v4.patch

OBS-URL: https://build.opensuse.org/request/show/1001670
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=146
2022-09-07 09:08:51 +00:00

121 lines
3.5 KiB
Diff

From ec2ee1c946ceefacb9f0df5d942d0a1dac40af9a Mon Sep 17 00:00:00 2001
From: Steffen Butzer <steffen.butzer@outlook.com>
Date: Sat, 16 Jul 2022 18:36:44 +0200
Subject: [PATCH] dump_fs_locks: support v4
---
debugfs.ocfs2/dump_fs_locks.c | 42 +++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/debugfs.ocfs2/dump_fs_locks.c b/debugfs.ocfs2/dump_fs_locks.c
index 05f5227470b0..546213cdc210 100644
--- a/debugfs.ocfs2/dump_fs_locks.c
+++ b/debugfs.ocfs2/dump_fs_locks.c
@@ -225,13 +225,14 @@ static void dump_meta_lvb(const char *raw_lvb, FILE *out)
}
/* 0 = eof, > 0 = success, < 0 = error */
-static int dump_version_two_and_three(FILE *file, FILE *out, int v3)
+static int dump_version_two_or_more(FILE *file, FILE *out, int version)
{
unsigned long long num_prmode, num_exmode;
unsigned int num_prmode_failed, num_exmode_failed;
unsigned long long total_prmode, total_exmode;
unsigned long long avg_prmode = 0, avg_exmode = 0;
unsigned int max_prmode, max_exmode, num_refresh;
+ unsigned long long last_prmode, last_exmode, wait;
int ret;
#define NSEC_PER_USEC 1000
@@ -244,7 +245,10 @@ static int dump_version_two_and_three(FILE *file, FILE *out, int v3)
"%llu\t"
"%u\t"
"%u\t"
- "%u",
+ "%u\t"
+ "%llu\t"
+ "%llu\t"
+ "%llu",
&num_prmode,
&num_exmode,
&num_prmode_failed,
@@ -253,13 +257,16 @@ static int dump_version_two_and_three(FILE *file, FILE *out, int v3)
&total_exmode,
&max_prmode,
&max_exmode,
- &num_refresh);
- if (ret != 9) {
+ &num_refresh,
+ &last_prmode,
+ &last_exmode,
+ &wait);
+ if (ret != 12) {
ret = -EINVAL;
goto out;
}
- if (!v3) {
+ if (version < 3) {
max_prmode /= NSEC_PER_USEC;
max_exmode /= NSEC_PER_USEC;
}
@@ -271,14 +278,26 @@ static int dump_version_two_and_three(FILE *file, FILE *out, int v3)
avg_exmode = total_exmode/num_exmode;
fprintf(out, "PR > Gets: %llu Fails: %u Waits Total: %lluus "
- "Max: %uus Avg: %lluns\n",
+ "Max: %uus Avg: %lluns",
num_prmode, num_prmode_failed, total_prmode/NSEC_PER_USEC,
max_prmode, avg_prmode);
+ if (version > 3) {
+ fprintf(out, " Last: %lluus", last_prmode);
+ }
+ fprintf(out, "\n");
fprintf(out, "EX > Gets: %llu Fails: %u Waits Total: %lluus "
- "Max: %uus Avg: %lluns\n",
+ "Max: %uus Avg: %lluns",
num_exmode, num_exmode_failed, total_exmode/NSEC_PER_USEC,
max_exmode, avg_exmode);
- fprintf(out, "Disk Refreshes: %u\n", num_refresh);
+ if (version > 3) {
+ fprintf(out, " Last: %lluus", last_exmode);
+ }
+ fprintf(out, "\n");
+ fprintf(out, "Disk Refreshes: %u", num_refresh);
+ if (version > 3) {
+ fprintf(out, " First Wait: %lluus", wait);
+ }
+ fprintf(out, "\n");
ret = 1;
out:
@@ -388,13 +407,13 @@ static int end_line(FILE *f)
return 0;
}
-#define CURRENT_PROTO 3
+#define CURRENT_PROTO 4
/* returns 0 on error or end of file */
static int dump_one_lockres(FILE *file, FILE *out, int lvbs, int only_busy,
struct list_head *locklist)
{
unsigned int version;
- int ret, v3;
+ int ret;
int skipped = 0;
ret = fscanf(file, "%x\t", &version);
@@ -413,8 +432,7 @@ static int dump_one_lockres(FILE *file, FILE *out, int lvbs, int only_busy,
if (!skipped) {
if (version > 1) {
- v3 = !!(version == 3);
- ret = dump_version_two_and_three(file, out, v3);
+ ret = dump_version_two_or_more(file, out, version);
if (ret <= 0)
return 0;
}
--
2.26.2