Skip to content

Commit 4f9c8b1

Browse files
authored
Merge pull request #18 from runloopai/adam/ext4-uninit-bg
Enable uninit_bg (gdt_csum) in ext4 mkfs for fast offline resize
2 parents 98a9c3d + e26f616 commit 4f9c8b1

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

CMake/Findphoton.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ include(FetchContent)
22
set(FETCHCONTENT_QUIET false)
33
set(PHOTON_ENABLE_EXTFS ON)
44

5+
# Runloop: patch Photon's ext4 mkfs to enable uninitialized block groups
6+
# (gdt_csum). This lets an offline resize2fs grow of a devbox rootfs mark new
7+
# inode tables uninitialized instead of zeroing them — a near-instant grow with
8+
# minimal writes into the layered (COW) block format.
9+
# Idempotent: skips if the patch is already applied (reverse-check succeeds).
10+
set(_photon_mkfs_patch "${CMAKE_CURRENT_LIST_DIR}/patches/photon-v0.6.17-ext4-uninit-bg.patch")
511
FetchContent_Declare(
612
photon
713
GIT_REPOSITORY https://github.com/alibaba/PhotonLibOS.git
814
GIT_TAG v0.6.17
15+
PATCH_COMMAND sh -c "git apply --reverse --check '${_photon_mkfs_patch}' 2>/dev/null || git apply '${_photon_mkfs_patch}'"
916
)
1017

1118
if(BUILD_TESTING)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--- a/fs/extfs/mkfs.cpp 2026-07-22 10:34:58
2+
+++ b/fs/extfs/mkfs.cpp 2026-07-22 10:34:58
3+
@@ -73,6 +73,13 @@
4+
ext2fs_set_feature_flex_bg(&fs_param);
5+
ext2fs_set_feature_extents(&fs_param);
6+
ext2fs_set_feature_extra_isize(&fs_param);
7+
+ // Runloop: enable uninitialized block groups (gdt_csum). An offline
8+
+ // resize2fs grow then marks new inode tables uninitialized instead of
9+
+ // zeroing them — a near-instant grow with minimal writes into the
10+
+ // layered (COW) block format. (metadata_csum is avoided: it seeds
11+
+ // checksums from s_uuid, which is set after ext2fs_initialize below, so
12+
+ // it would produce an invalid superblock checksum.)
13+
+ ext2fs_set_feature_gdt_csum(&fs_param);
14+
15+
fs_param.s_log_cluster_size = fs_param.s_log_block_size = 2;
16+
fs_param.s_desc_size = EXT2_MIN_DESC_SIZE_64BIT;

0 commit comments

Comments
 (0)