diff mbox series

[meta-oe] fio: fix musl builds

Message ID 20260306225737.2557642-1-max.oss.09@gmail.com
State New
Headers show
Series [meta-oe] fio: fix musl builds | expand

Commit Message

Max Krummenacher March 6, 2026, 10:57 p.m. UTC
fio 3.40 added the commit 4175f4dbec5d ("oslib: blkzoned: add
blkzoned_move_zone_wp() helper function") which uses
FALLOC_FL_ZERO_RANGE which in a musl build is undefined without
including its header.

Backport the upstream fix.

Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
---

With the patch applied a musl build now succeeds, a glibc build still succeeds.

 .../fio/fio/0001-fix-musl-builds.patch        | 38 +++++++++++++++++++
 meta-oe/recipes-benchmark/fio/fio_3.41.bb     |  5 ++-
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-benchmark/fio/fio/0001-fix-musl-builds.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-benchmark/fio/fio/0001-fix-musl-builds.patch b/meta-oe/recipes-benchmark/fio/fio/0001-fix-musl-builds.patch
new file mode 100644
index 000000000000..6c0d69d6e8a3
--- /dev/null
+++ b/meta-oe/recipes-benchmark/fio/fio/0001-fix-musl-builds.patch
@@ -0,0 +1,38 @@ 
+From ccce76d2850d6e52da3d7986c950af068fbfe0fd Mon Sep 17 00:00:00 2001
+From: Arthur Gautier <arthur.gautier@arista.com>
+Date: Sat, 13 Dec 2025 20:07:11 -0800
+Subject: [PATCH] fix musl builds
+
+This commit fixes the build on musl which fails with the following
+error:
+```
+oslib/linux-blkzoned.c: In function 'blkzoned_move_zone_wp':
+oslib/linux-blkzoned.c:389:37: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function)
+  389 |                 ret = fallocate(fd, FALLOC_FL_ZERO_RANGE, z->wp, length);
+      |                                     ^~~~~~~~~~~~~~~~~~~~
+oslib/linux-blkzoned.c:389:37: note: each undeclared identifier is reported only once for each function it appears in
+make: *** [Makefile:501: oslib/linux-blkzoned.o] Error 1
+make: *** Waiting for unfinished jobs....
+```
+
+Upstream-Status: Backport [https://github.com/axboe/fio/commit/ccce76d2850d6e52da3d7986c950af068fbfe0fd]
+Signed-off-by: Arthur Gautier <arthur.gautier@arista.com>
+---
+ oslib/linux-blkzoned.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/oslib/linux-blkzoned.c b/oslib/linux-blkzoned.c
+index 78e25fca..c45ef623 100644
+--- a/oslib/linux-blkzoned.c
++++ b/oslib/linux-blkzoned.c
+@@ -25,6 +25,7 @@
+ #ifndef BLKFINISHZONE
+ #define BLKFINISHZONE _IOW(0x12, 136, struct blk_zone_range)
+ #endif
++#include <linux/falloc.h>
+ 
+ /*
+  * If the uapi headers installed on the system lacks zone capacity support,
+-- 
+2.51.0
+
diff --git a/meta-oe/recipes-benchmark/fio/fio_3.41.bb b/meta-oe/recipes-benchmark/fio/fio_3.41.bb
index 494a4eb3d7ed..3f03c41f220b 100644
--- a/meta-oe/recipes-benchmark/fio/fio_3.41.bb
+++ b/meta-oe/recipes-benchmark/fio/fio_3.41.bb
@@ -22,7 +22,10 @@  PACKAGECONFIG_NUMA:armeb = ""
 PACKAGECONFIG ??= "${PACKAGECONFIG_NUMA}"
 PACKAGECONFIG[numa] = ",--disable-numa,numactl"
 
-SRC_URI = "git://git.kernel.dk/fio.git;branch=master;tag=${BP}"
+SRC_URI = " \
+    git://git.kernel.dk/fio.git;branch=master;tag=${BP} \
+    file://0001-fix-musl-builds.patch \
+"
 SRCREV = "ed675d3477a70a42d2e757b713f6c7125a27cdca"
 
 SRC_URI += "file://CVE-2025-10823.patch"