[PATCH v1 07/13] ntfs: respect space reservations when writing compressed data

From: Baolin Liu

Date: Wed Dec 02 2026 - 23:06:41 EST


From: Baolin Liu <liubaolin@xxxxxxxxxx>

Compressed writes allocate clusters synchronously without reserving
delayed-allocation space. Passing is_dealloc=true nevertheless bypasses
the reservation check and releases dirty_clusters for space the writer
never reserved. This can consume space promised to buffered writes.

Use a normal data allocation for compressed writes. This preserves
outstanding reservations and will also respect the metadata reserve
added next, without changing compression-unit placement or the
contiguous-allocation requirement.

Fixes: 495e90fa3348 ("ntfs: update attrib operations")
Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
---
fs/ntfs/compress.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c
index 8a60f5e13202..01582f64d4c2 100644
--- a/fs/ntfs/compress.c
+++ b/fs/ntfs/compress.c
@@ -1403,8 +1403,9 @@ static int ntfs_write_cb(struct ntfs_inode *ni, loff_t pos, struct page **pages,

new_length = ntfs_bytes_to_cluster(vol, round_up(bio_size, vol->cluster_size));

+ /* Compressed writes allocate synchronously, without delalloc reservations. */
rlc = ntfs_cluster_alloc(vol, new_vcn, new_length, -1, DATA_ZONE,
- false, true, true);
+ false, true, false);
if (IS_ERR(rlc)) {
err = PTR_ERR(rlc);
goto out;