Skip to content

New parameter for ublk threadPoolSize and supports different ioEngine for the upper datafile - #470

Open
BigVan wants to merge 2 commits into
containerd:mainfrom
BigVan:main
Open

BigVan wants to merge 2 commits into
containerd:mainfrom
BigVan:main

Conversation

@BigVan

@BigVan BigVan commented Oct 19, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

  • Make ublk per-queue threadPool size configurable
  • Open upper datafile with the configured ioEngine

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Yifan Yuan added 2 commits October 20, 2026 00:13
The writable layer's datafile now honors the global ioEngine so it can
use libaio (O_DIRECT, wrapped in a 4K aligned adaptor) instead of always
going through psync. turboOCI target/gzip files and posixaio fall back
to psync. LSMT appends use positioned writes so the aligned adaptor stays
in the I/O path, and both TCMU and ublk photon envs init libaio.

Signed-off-by: Yifan Yuan <tuji.yyf@outlook.com>
Each ublk queue caches a fixed 32 photon I/O threads; with a deeper
queue every I/O beyond that creates and destroys its own thread.
Expose the size as ublkThreadPoolSize in overlaybd.json, default 32.

Signed-off-by: Yifan Yuan <tuji.yyf@outlook.com>
@BigVan
BigVan requested review from liulanzheng and a balanced review from Copilot and removed request for Copilot October 19, 2026 16:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Direct-I/O opening needs correction, and alignment-sensitive sealing needs regression validation before human approval.

1 open issue
What changed in this PR

This PR makes ublk queue thread caching configurable and extends configured I/O-engine support to writable upper data files.

Changes:

  • Adds ublkThreadPoolSize, defaulting to 32, with configuration documentation.
  • Enables libaio initialization and aligned upper-file I/O.
  • Updates positioned LSMT writes and adds upper-engine regression tests.
File Description
src/​ublk/​ublk_device.cpp Configures queue thread pools and initializes libaio.
src/​test/​image_service_test.cpp Tests upper-file engines, concurrent writes, and reopening.
src/​overlaybd/​lsmt/​file.cpp Uses positioned writes for data, indexes, and trailers.
src/​main.cpp Enables libaio in shared I/O workers.
src/​image_file.cpp Selects upper-file engines and adds alignment handling.
src/​example_config/​overlaybd.json Adds the thread-pool setting.
src/​config.h Defines the setting and default.
README.md Documents per-queue thread caching.

Review effort: Balanced

Comment thread src/image_file.cpp
auto engine = image_service.global_conf.ioEngine();
if (!upper.target().empty() || engine == ioengine_posixaio)
engine = ioengine_psync;
data_file = open_localfile_adaptor(upper.data().c_str(), O_RDWR, 0644, engine);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants