Re: [PATCH v1 00/13] ntfs: add large folio support for ordinary files

From: liubaolin

Date: Thu Dec 03 2026 - 05:10:52 EST




在 2026/12/3 13:30, Namjae Jeon 写道:
On Thu, Dec 3, 2026 at 1:23 PM liubaolin <liubaolin12138@xxxxxxx> wrote:



在 2026/12/3 12:03, Baolin Liu 写道:
From: Baolin Liu <liubaolin@xxxxxxxxxx>

This series enables large page-cache folios for ordinary, unnamed NTFS
regular-file data streams through iomap. It applies to ntfs-next at
f674e4b6c315 ("ntfs: serialize export parent reconstruction"), fetched on
26 November 2026, with no additional prerequisite patches.

Large folios require CONFIG_TRANSPARENT_HUGEPAGE; order-0 fallback remains
available. The policy excludes metadata, SYSTEM-marked files, directories,
named/internal streams, MST-protected data, encrypted files and files
already using native or WOF compression when initialized. It covers new
files, O_TMPFILE files and resident files that grow nonresident.

Empty files can change native compression while retaining their original
folio policy. Prepare compressed reads and writes for this case, including
folios spanning compression units. Retained VMAs can still read; writes
through retained shared writable VMAs fault with SIGBUS. New mmap requests
for compressed files remain unsupported.

Patches 1-8 fix writeback, cache-coherency, locking and space-accounting
issues found during validation without large folios. Patch 8 keeps 2% of
the volume, capped at 4096 clusters, for MFT, MFT bitmap and attribute-list
growth. This reduces f_bavail and data capacity, including for root, and
is separate from MFT zone placement. Patches 9-12 handle compression
switching, folio I/O and EOF within a base page. Patch 13 enables large
folios and documents the scope.

Performance measurements compare an order-0 kernel based on 8a27d1f43f1b
with a large-folio-enabled build of the same base. The setup was x86-64
KVM (2 vCPUs, 3 GiB RAM), NVMe-backed raw images on host ext4, 512-byte
NTFS clusters and 1 GiB files. fio 3.41 used one buffered psync worker,
1 MiB sequential I/O and 4 KiB random reads. Tracing was disabled during
timing.

The mixed workload used four VM boots in control/folio/folio/control
order, with five rounds per boot. Values are medians within each boot,
then medians across boots:

Metric Order-0 Large folios Change
Warm sequential read (MiB/s) 16012 18616 +16.3%
Warm random read (MiB/s) 5098 6265 +22.9%
Write + fsync (MiB/s) 2449 2691 +9.9%
mmap page-touch, 50 passes (s) 1.689 1.460 -13.6%
Cold sequential read (MiB/s) 3489 3382 -3.1%
Cold-read task CPU (s/GiB) 0.1295 0.0655 -49.4%
Write task CPU (s/GiB) 0.1550 0.0655 -57.7%

CPU figures are fio task user+system time per GiB, excluding host QEMU
CPU. A follow-up cold-read-only comparison reused the same read-only
image across eight boots (ABBA + BAAB, five rounds per boot). Throughput
was 3568 versus 3619 MiB/s (+1.4%, broadly unchanged), while task CPU
fell from 0.1260 to 0.0655 s/GiB (-48.0%). All boots, including one slow
control boot, are included. These measurements show lower task CPU cost
and gains in cached reads and writes under this VM-backed storage setup;
they do not establish a general cold-read throughput improvement.

Offline consistency checks used ntfsck from ntfsprogs-plus. The x86
guests invoked it as fsck.ntfs -n after unmounting the test volumes.

Functional and regression tests used the same source trees as this
series and its control:

- W=1 fs/ntfs builds at every patch boundary with debug and minimal
configurations; full x86-64 and ARM64 64 KiB-page kernel builds.
- x86-64 KVM: 111 data comparisons and ten offline consistency checks
passed.
- ARM64 TCG with 64 KiB base pages: 136 checks, ten compressed EOF
cases and three offline consistency checks passed; observed folio
orders 1-6.
- Six complete x86-64 KVM xfstests auto runs with identical kernel
configurations and xfstests v2025.11.04-10-gdf376ed02:

Cluster Control pass/fail/notrun Series pass/fail/notrun
512 B 306 / 45 / 212 308 / 43 / 212
4 KiB 309 / 45 / 209 309 / 45 / 209
64 KiB 307 / 45 / 211 307 / 45 / 211

The control includes patches 1-8, so the auto comparison isolates patches
9-13. All 563 selected tests completed per run, retaining the appliance's
210 default exclusions and adding none. There were no new failures or
notruns, and notrun reasons matched.

Existing failures include consistency errors reported by ntfsck on the
scratch filesystem. ARM64 testing did not cover 512 MiB PMD collapse and
still reported the existing MFT extent-record diagnostic on 512-byte
clusters. Some x86 guests reported root ext4/vda I/O errors after
power-down.

Baolin Liu (13):
ntfs: limit writeback allocation to the dirty range
ntfs: read compression units without the block device page cache
ntfs: snapshot resident data for direct reads
ntfs: allow vmalloc for large runlist backups
ntfs: preserve delalloc reservations when allocating holes
ntfs: serialize delalloc reservations with cluster allocation
ntfs: respect space reservations when writing compressed data
ntfs: keep space for MFT growth during delayed allocation
ntfs: serialize compression changes with file access
ntfs: complete compressed reads at folio granularity
ntfs: stop compressed reads at EOF within a base page
ntfs: preserve large folios during compressed writes
ntfs: enable large folios for ordinary files

Documentation/filesystems/ntfs.rst | 34 ++++
fs/ntfs/attrib.c | 15 +-
fs/ntfs/attrlist.c | 2 +-
fs/ntfs/compress.c | 317 +++++++++++++++--------------
fs/ntfs/ea.c | 7 +
fs/ntfs/file.c | 26 ++-
fs/ntfs/inode.c | 10 +
fs/ntfs/iomap.c | 43 +++-
fs/ntfs/lcnalloc.c | 18 +-
fs/ntfs/lcnalloc.h | 13 +-
fs/ntfs/mft.c | 7 +-
fs/ntfs/ntfs_codec.h | 2 +-
fs/ntfs/super.c | 18 +-
fs/ntfs/volume.h | 2 +
14 files changed, 317 insertions(+), 197 deletions(-)


base-commit: f674e4b6c315ebe742d08af80659386992d58ce9

Hi Namjae and Hyunchul,
I've posted a 13-patch series adding large folio support for ordinary
NTFS files. It covers buffered I/O and mmap for unnamed, uncompressed
data streams, while keeping order-0 fallback:
https://lore.kernel.org/all/20261203040352.1161120-1-liubaolin12138@xxxxxxx/
Okay, could you please check Sashiko's review comments ?

https://sashiko.dev/#/patchset/20261203040352.1161120-1-liubaolin12138%40163.com

Hi Namjae,
Sure, I'll go through Sashiko's comments, address any issues I find, and send v2 as soon as I can.

Thanks,
Baolin.


In my x86-64 KVM tests with NVMe-backed storage and 512-byte
clusters, warm sequential reads improved by 16.3% and warm random reads
by 22.9%. Buffered writes including fsync improved by 9.9%. fio task CPU
time per GiB also fell by about 48% for cold reads and 57.7% for writes.
I also ran kvm-xfstests auto with 512-byte, 4 KiB and 64 KiB
clusters. With the same baseline fixes in both kernels, we saw no new
failures or skips after adding large folio support. The cover letter has
the detailed results.
Thanks for the work and test:)

I also plan to work with some colleagues and friends to investigate
the existing failures and the reasons for the skipped tests.
Sounds good.
When you have a chance, I'd appreciate your review and any suggestions.
Okay, I will check it.

Thanks!

Thanks,
Baolin.