Skip to content

Commit 10d7c95

Browse files
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>
1 parent c5226b9 commit 10d7c95

12 files changed

Lines changed: 886 additions & 344 deletions

File tree

fs/ntfs3/attrib.c

Lines changed: 243 additions & 90 deletions
Large diffs are not rendered by default.

fs/ntfs3/attrlist.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name,
345345
le->id = id;
346346
memcpy(le->name, name, sizeof(short) * name_len);
347347

348-
err = attr_set_size(ni, ATTR_LIST, NULL, 0, &al->run, new_size,
349-
&new_size, true, &attr);
348+
err = attr_set_size_ex(ni, ATTR_LIST, NULL, 0, &al->run, new_size,
349+
&new_size, true, &attr, false);
350350
if (err) {
351351
/* Undo memmove above. */
352352
memmove(le, Add2Ptr(le, sz), old_size - off);
@@ -404,8 +404,8 @@ int al_update(struct ntfs_inode *ni, int sync)
404404
* Attribute list increased on demand in al_add_le.
405405
* Attribute list decreased here.
406406
*/
407-
err = attr_set_size(ni, ATTR_LIST, NULL, 0, &al->run, al->size, NULL,
408-
false, &attr);
407+
err = attr_set_size_ex(ni, ATTR_LIST, NULL, 0, &al->run, al->size, NULL,
408+
false, &attr, false);
409409
if (err)
410410
goto out;
411411

0 commit comments

Comments
 (0)