]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs/ntfs3: add delayed-allocation (delalloc) support
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Mon, 16 Feb 2026 16:10:26 +0000 (17:10 +0100)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Mon, 16 Feb 2026 16:23:51 +0000 (17:23 +0100)
commit10d7c95af043b45a85dc738c3271bf760ff3577e
tree2c10058d39457c5a01ef3c1c2532212ade3eed9b
parentc5226b96c08a010ebef5fdf4c90572bcd89e4299
fs/ntfs3: add delayed-allocation (delalloc) support

This patch implements delayed allocation (delalloc) in ntfs3 driver.

It introduces an in-memory delayed-runlist (run_da) and the helpers to
track, reserve and later convert those delayed reservations into real
clusters at writeback time. The change keeps on-disk formats untouched and
focuses on pagecache integration, correctness and safe interaction with
fallocate, truncate, and dio/iomap paths.

Key points:

- add run_da (delay-allocated run tree) and bookkeeping for delayed clusters.

- mark ranges as delalloc (DELALLOC_LCN) instead of immediately allocating.
  Actual allocation performed later (writeback / attr_set_size_ex / explicit
  flush paths).

- direct i/o / iomap paths updated to avoid dio collisions with
  delalloc: dio falls back or forces allocation of delayed blocks before
  proceeding.

- punch/collapse/truncate/fallocate check and cancel delay-alloc reservations.
  Sparse/compressed files handled specially.

- free-space checks updated (ntfs_check_free_space) to account for reserved
  delalloc clusters and MFT record budgeting.

- delayed allocations are committed on last writer (file release) and on
  explicit allocation flush paths.

Tested-by: syzbot@syzkaller.appspotmail.com
Reported-by: syzbot+2bd8e813c7f767aa9bb1@syzkaller.appspotmail.com
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
12 files changed:
fs/ntfs3/attrib.c
fs/ntfs3/attrlist.c
fs/ntfs3/file.c
fs/ntfs3/frecord.c
fs/ntfs3/fsntfs.c
fs/ntfs3/index.c
fs/ntfs3/inode.c
fs/ntfs3/ntfs.h
fs/ntfs3/ntfs_fs.h
fs/ntfs3/run.c
fs/ntfs3/super.c
fs/ntfs3/xattr.c