From 831d85822e8460b8cd0118686ad028238be89052 Mon Sep 17 00:00:00 2001 From: zhanchengbin Date: Sat, 9 Oct 2021 15:14:34 +0800 Subject: [PATCH] Fixed the issue of modifying parallel compilation (cherry picked from commit 5c12e469261836e26e6b3e0a2992f3cf18b86caf) --- 0018-fix-parallel-build-failures.patch | 70 +++++++++++++++++++ ...x-parallel-build-of-btt-and-blkiomon.patch | 38 ++++++++++ blktrace.spec | 7 +- 3 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 0018-fix-parallel-build-failures.patch create mode 100644 0019-fix-parallel-build-of-btt-and-blkiomon.patch diff --git a/0018-fix-parallel-build-failures.patch b/0018-fix-parallel-build-failures.patch new file mode 100644 index 0000000..a836c83 --- /dev/null +++ b/0018-fix-parallel-build-failures.patch @@ -0,0 +1,70 @@ +From 519fd9a5d08d85f3d9cb4192d624fe8351e40232 Mon Sep 17 00:00:00 2001 +From: "Robin H. Johnson" +Date: Tue, 23 Jan 2018 17:57:55 -0500 +Subject: [PATCH] fix parallel build failures + +When building in parallel, the btreplay/btrecord and btreplay/btreplay +targets cause make to kick off two jobs for `make -C btreplay` and they +sometimes end up clobbering each other. We could fix this by making one +a dependency of the other, but it's a bit cleaner to refactor things to +be based on subdirs. This way changes in subdirs also get noticed: + $ touch btreplay/*.[ch] + $ make + + +Signed-off-by: Robin H. Johnson +Signed-off-by: Mike Frysinger +Signed-off-by: Jens Axboe +--- + Makefile | 24 ++++++++++-------------- + 1 file changed, 10 insertions(+), 14 deletions(-) + +diff --git a/Makefile b/Makefile +index 68de591..5917814 100644 +--- a/Makefile ++++ b/Makefile +@@ -4,23 +4,19 @@ ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + PROGS = blkparse blktrace verify_blkparse blkrawverify blkiomon + LIBS = -lpthread + SCRIPTS = btrace ++SUBDIRS = btreplay btt iowatcher + +-ALL = $(PROGS) $(SCRIPTS) btt/btt btreplay/btrecord btreplay/btreplay \ ++ALL = $(PROGS) $(SCRIPTS) ++INSTALL_ALL = $(ALL) btt/btt btreplay/btrecord btreplay/btreplay \ + btt/bno_plot.py iowatcher/iowatcher + +-all: $(ALL) ++all: $(ALL) $(SUBDIRS) + +-btt/btt: +- $(MAKE) -C btt +- +-iowatcher/iowatcher: +- $(MAKE) -C iowatcher +- +-btreplay/btrecord: +- $(MAKE) -C btreplay +- +-btreplay/btreplay: +- $(MAKE) -C btreplay ++# We always descend into subdirs because they contain their own dependency ++# information which we don't track in this top level Makefile. ++$(SUBDIRS): ++ $(MAKE) -C $@ ++.PHONY: $(SUBDIRS) + + %.o: %.c + $(CC) -o $*.o -c $(ALL_CFLAGS) $< +@@ -85,7 +81,7 @@ install: all + $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 + $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8 +- $(INSTALL) -m 755 $(ALL) $(DESTDIR)$(bindir) ++ $(INSTALL) -m 755 $(INSTALL_ALL) $(DESTDIR)$(bindir) + $(INSTALL) -m 644 doc/*.1 $(DESTDIR)$(mandir)/man1 + $(INSTALL) -m 644 doc/*.8 $(DESTDIR)$(mandir)/man8 + +-- +1.8.3.1 + diff --git a/0019-fix-parallel-build-of-btt-and-blkiomon.patch b/0019-fix-parallel-build-of-btt-and-blkiomon.patch new file mode 100644 index 0000000..0df789a --- /dev/null +++ b/0019-fix-parallel-build-of-btt-and-blkiomon.patch @@ -0,0 +1,38 @@ +From f4f8ef7cdea138cfaa2f3ca0ee31fa23d3bcf1cc Mon Sep 17 00:00:00 2001 +From: Gwendal Grignou +Date: Thu, 16 Jan 2020 12:33:26 -0800 +Subject: [PATCH] fix parallel build of btt and blkiomon + +rbtree.c is used by both binaries. It is possible that when make -C btt +is invoked rbtree.o does not exist yet, but is already schedule by the +compilation of blkiomon. That could result in recompiling rbtree.o again +for btt/btt. +In that case, at install time, make will recompile blkiomon which can +fail in gentoo, because CC variable is not overriden by ebuild script at +install time. (see https://bugs.gentoo.org/705594) + +Add a dependency on SUBDIRS to wait for all binary in . to be compiled. +It will guarante rbtree.o exists. + +Signed-off-by: Gwendal Grignou +Signed-off-by: Jens Axboe +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 5917814..eb3c6a1 100644 +--- a/Makefile ++++ b/Makefile +@@ -14,7 +14,7 @@ all: $(ALL) $(SUBDIRS) + + # We always descend into subdirs because they contain their own dependency + # information which we don't track in this top level Makefile. +-$(SUBDIRS): ++$(SUBDIRS): $(PROGS) + $(MAKE) -C $@ + .PHONY: $(SUBDIRS) + +-- +1.8.3.1 + diff --git a/blktrace.spec b/blktrace.spec index 691efd2..a4dd707 100644 --- a/blktrace.spec +++ b/blktrace.spec @@ -1,6 +1,6 @@ Name: blktrace Version: 1.2.0 -Release: 25 +Release: 26 Summary: Block IO tracer in the Linux kernel License: GPLv2+ Source: http://brick.kernel.dk/snaps/blktrace-%{version}.tar.bz2 @@ -28,6 +28,8 @@ Patch14: 0014-blkparse-Allow-request-tracking-on-non-md-dm-devices.patch Patch15: 0015-blkparse-Initialize-and-test-for-undefined-request-t.patch Patch16: blktrace-fix-exit-directly-when-nthreads-running.patch Patch17: 0017-blktrace-Makefile-add-fstack-protector-strong-flag.patch +Patch18: 0018-fix-parallel-build-failures.patch +Patch19: 0019-fix-parallel-build-of-btt-and-blkiomon.patch %description blktrace is a block layer IO tracing mechanism which provides detailed @@ -62,6 +64,9 @@ make dest=%{buildroot} prefix=%{buildroot}/%{_prefix} mandir=%{buildroot}/%{_man %{_mandir}/man8/* %changelog +* Sat Oct 09 2021 zhanchengbin - 1.2.0-26 +- Fixed the issue of modifying parallel compilation + * Wed Sep 29 2021 Wenchao Hao - 1.2.0-25 - NOP:nothing but to make it able to sync between differnt branches -- Gitee