Skip to content

Commit a6bc7f6

Browse files
committed
osbuild: backport patches for setting xfs agcount
This will allow us to set the agcount when creating XFS filesystems. osbuild/osbuild#2241
1 parent b68d7dd commit a6bc7f6

File tree

2 files changed

+76
-20
lines changed

2 files changed

+76
-20
lines changed

build.sh

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,26 +192,25 @@ write_archive_info() {
192192
}
193193

194194
patch_osbuild() {
195-
return # No patches at this time
196-
# # Add a few patches that either haven't made it into a release or
197-
# # that will be obsoleted with other work that will be done soon.
198-
# #
199-
# # To make it easier to apply patches we'll move around the osbuild
200-
# # code on the system first:
201-
# rmdir /usr/lib/osbuild/osbuild
202-
# python_lib_dir=$(ls -d /usr/lib/python*)
203-
# mv ${python_lib_dir}/site-packages/osbuild /usr/lib/osbuild/
204-
# mkdir -p /usr/lib/osbuild/tools
205-
# mv /usr/bin/osbuild-mpp /usr/lib/osbuild/tools/
206-
# # Now all the software is under the /usr/lib/osbuild dir and we can patch
207-
# cat \
208-
# /usr/lib/coreos-assembler/0001.patch \
209-
# | patch -d /usr/lib/osbuild -p1
210-
# # And then move the files back; supermin appliance creation will need it back
211-
# # in the places delivered by the RPM.
212-
# mv /usr/lib/osbuild/tools/osbuild-mpp /usr/bin/osbuild-mpp
213-
# mv /usr/lib/osbuild/osbuild ${python_lib_dir}/site-packages/osbuild
214-
# mkdir -p /usr/lib/osbuild/osbuild
195+
# Add a few patches that either haven't made it into a release or
196+
# that will be obsoleted with other work that will be done soon.
197+
#
198+
# To make it easier to apply patches we'll move around the osbuild
199+
# code on the system first:
200+
rmdir /usr/lib/osbuild/osbuild
201+
python_lib_dir=$(ls -d /usr/lib/python*)
202+
mv ${python_lib_dir}/site-packages/osbuild /usr/lib/osbuild/
203+
mkdir -p /usr/lib/osbuild/tools
204+
mv /usr/bin/osbuild-mpp /usr/lib/osbuild/tools/
205+
# Now all the software is under the /usr/lib/osbuild dir and we can patch
206+
cat \
207+
/usr/lib/coreos-assembler/0001-stages-mkfs.xfs-support-setting-agcount.patch \
208+
| patch -d /usr/lib/osbuild -p1
209+
# And then move the files back; supermin appliance creation will need it back
210+
# in the places delivered by the RPM.
211+
mv /usr/lib/osbuild/tools/osbuild-mpp /usr/bin/osbuild-mpp
212+
mv /usr/lib/osbuild/osbuild ${python_lib_dir}/site-packages/osbuild
213+
mkdir -p /usr/lib/osbuild/osbuild
215214
}
216215

217216
if [ $# -ne 0 ]; then
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From 279ca188b6e44da26fae4491366cc21d66cd6406 Mon Sep 17 00:00:00 2001
2+
From: Dusty Mabe <[email protected]>
3+
Date: Tue, 11 Nov 2025 21:37:17 -0500
4+
Subject: [PATCH] stages/mkfs.xfs: support setting agcount
5+
6+
For disk images (and the filesystems on them) that are created and later
7+
grown there can be a performance issue if the agcount for XFS
8+
filesystems increases many times because of the growfs.
9+
10+
In order to help reduce the chances of performance issues happening we
11+
want to be able to set the agcount on newly created filesystems to
12+
2 (current default is 4) [1].
13+
14+
[1] https://github.com/coreos/fedora-coreos-tracker/issues/1993#issuecomment-3184392894
15+
---
16+
stages/org.osbuild.mkfs.xfs | 6 +++++-
17+
stages/org.osbuild.mkfs.xfs.meta.json | 4 ++++
18+
2 files changed, 9 insertions(+), 1 deletion(-)
19+
20+
diff --git a/stages/org.osbuild.mkfs.xfs b/stages/org.osbuild.mkfs.xfs
21+
index ebb414a3..b4481655 100755
22+
--- a/stages/org.osbuild.mkfs.xfs
23+
+++ b/stages/org.osbuild.mkfs.xfs
24+
@@ -10,10 +10,14 @@ def main(devices, options):
25+
26+
uuid = options["uuid"]
27+
label = options.get("label")
28+
+ agcount = options.get("agcount")
29+
opts = []
30+
31+
if label:
32+
- opts = ["-L", label]
33+
+ opts.extend(["-L", label])
34+
+
35+
+ if agcount:
36+
+ opts.extend(["-d", f"agcount={agcount}"])
37+
38+
subprocess.run(["mkfs.xfs", "-m", f"uuid={uuid}"] + opts + [device],
39+
encoding='utf8', check=True)
40+
diff --git a/stages/org.osbuild.mkfs.xfs.meta.json b/stages/org.osbuild.mkfs.xfs.meta.json
41+
index d832b77e..25f1da18 100644
42+
--- a/stages/org.osbuild.mkfs.xfs.meta.json
43+
+++ b/stages/org.osbuild.mkfs.xfs.meta.json
44+
@@ -33,6 +33,10 @@
45+
"description": "Label for the file system",
46+
"type": "string",
47+
"maxLength": 12
48+
+ },
49+
+ "agcount": {
50+
+ "description": "The number of allocation groups for the file system",
51+
+ "type": "integer"
52+
}
53+
}
54+
}
55+
--
56+
2.51.0
57+

0 commit comments

Comments
 (0)