diff --git a/bug-1203166-dump_fs_locks-support-v4.patch b/bug-1203166-dump_fs_locks-support-v4.patch new file mode 100644 index 0000000..70bb2d1 --- /dev/null +++ b/bug-1203166-dump_fs_locks-support-v4.patch @@ -0,0 +1,120 @@ +From ec2ee1c946ceefacb9f0df5d942d0a1dac40af9a Mon Sep 17 00:00:00 2001 +From: Steffen Butzer +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 + diff --git a/ocfs2-tools.changes b/ocfs2-tools.changes index 196d9a5..db87883 100644 --- a/ocfs2-tools.changes +++ b/ocfs2-tools.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Sep 7 10:26:00 UTC 2022 - heming.zhao@suse.com + +- 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 + ------------------------------------------------------------------- Tue Mar 22 14:40:00 UTC 2022 - heming.zhao@suse.com diff --git a/ocfs2-tools.spec b/ocfs2-tools.spec index b174221..19a586a 100644 --- a/ocfs2-tools.spec +++ b/ocfs2-tools.spec @@ -55,10 +55,12 @@ Patch225: 0004-mkfs.ocfs2-Abort-if-cluster-information-is-not-detec.patch Patch228: 0007-Improve-error-message-if-DLM-service-is-unavailable.patch Patch405: 0007-vendor-Add-vendor-files-for-sles12.patch Patch406: 0008-ocfs2-tools-add-systemd-support-fix.patch +# below are upstream patches Patch501: fixed-mounted.ocfs2-output-when-some-devices-are-Not.patch Patch502: update-mounted.ocfs2-mounted.c.patch Patch503: libocfs2-roll-back-when-dir_index-creation-fails.patch Patch504: fsck.ocfs2-do-not-try-locking-after-replaying-journa.patch +Patch505: bug-1203166-dump_fs_locks-support-v4.patch BuildRequires: autoconf BuildRequires: e2fsprogs-devel @@ -170,6 +172,7 @@ OCFS2 filesystem. %patch502 -p1 %patch503 -p1 %patch504 -p1 +%patch505 -p1 %build %global _lto_cflags %{_lto_cflags} -ffat-lto-objects @@ -218,8 +221,6 @@ cd reflink make DESTDIR="%{buildroot}" install cd .. -rm %{buildroot}/sbin/defragfs.ocfs2 -rm %{buildroot}/%{_mandir}/man8/defragfs.ocfs2.8 mv %{buildroot}/{,/usr}/sbin/o2image mv %{buildroot}/{,/usr}/sbin/debugfs.ocfs2 #mv %{buildroot}/{,/usr}/sbin/ocfs2_controld.pcmk @@ -272,6 +273,7 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir} /sbin/mount.ocfs2 /sbin/ocfs2_hb_ctl /sbin/o2cluster +/sbin/defragfs.ocfs2 %{_sbindir}/o2image %{_sbindir}/debugfs.ocfs2 %{_sbindir}/o2hbmonitor @@ -289,6 +291,7 @@ python -c "import compileall; compileall.compile_dir('%{buildroot}/%{py_sitedir} %{_mandir}/man8/o2image.8.gz %{_mandir}/man8/o2cluster.8.gz %{_mandir}/man8/o2hbmonitor.8.gz +%{_mandir}/man8/defragfs.ocfs2.8* %{_mandir}/man5/o2cb.sysconfig.5.gz %{_mandir}/man5/ocfs2.cluster.conf.5.gz %{_mandir}/man7/ocfs2.7.gz