mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ernest Borowski <ernest.borowski.git@proton.me>
To: Baolin Liu <liubaolin12138@163.com>
Cc: linkinjeon@kernel.org, hyc.lee@gmail.com, ntfs@lists.linux.dev,
	linux-kernel@vger.kernel.org, Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH v1 01/13] ntfs: limit writeback allocation to the dirty range
Date: Fri, 04 Dec 2026 18:45:47 +0000	[thread overview]
Message-ID: <179640993906.154108.3521906504217124720.b4-reply@b4> (raw)
In-Reply-To: <20261203040352.1161120-2-liubaolin12138@163.com>

Hi Baolin,

On Thu, Dec 03, 2026 at 12:03:40PM +0800, Baolin Liu wrote:
> A buffered write into a hole reserves space before copying user data.
> If the copy faults partway through, writeback can allocate the clean
> remainder of the reservation because it maps up to allocated_size.
> After fsync and cache eviction, reads can expose old disk contents
> instead of zeros.

Patch 13 of my delalloc series v5 [1] fixes the same bug in a different
way: writeback maps up to the end of the dirty folios that follow the
one being written, and zeroes a cluster larger than a page on the disk
only when some of its folios below initialized_size are not dirty.  I
ran your patch, ported onto patches 1-12 of v5, through our reproducers
on the current ntfs-next.  It passes the same ones as patch 13
(killed_short_write_wb, hole_fill_stale, stale_wb_race and the others).

Mapping one dirty range at a time costs time with clusters larger than
a page, because every new cluster is zeroed on the disk before its
first folio is written.  fsync() of 384 MiB written into new space, 3
runs each, on a kernel without debug options:

  cluster size     your patch       patch 13         ntfs-next
  512 B, 4 KiB     98-113 ms        111-140 ms       172-204 ms
  64 KiB           242-260 ms       110-120 ms       170-177 ms

Your patch also makes mkwrite_past_init pass, which patch 13 does not.
That test stores through a shared mapping 2 MiB into a file whose
initialized size is 4 KiB, and then reads the tail of the first cluster.
Your patch zeroes the whole first cluster when the first 4 KiB are
written back, so the tail happens to be zero.  From reading the code, a
cluster allocated another way, for example by fallocate(), would still
show old data there; I have not tested that.  Zhan's "ntfs: zero up to a
page that a shared mapping makes writable" [2] fixes that case where it
starts, when the write fault moves the initialized size.

Would you be fine with dropping 1/13 from the large folio series and
basing it on the delalloc series instead?  I have not tested the large
folio patches on top of v5.

[1] https://lore.kernel.org/all/20261204-b4-ntfs-delalloc-fixes-v5-0-1cd0267df2cd@proton.me/
[2] https://lore.kernel.org/all/20261201125126.1651071-1-zhanxusheng1024@gmail.com/

Thanks,
Ernest


  reply	other threads:[~2026-12-04 18:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  4:03 [PATCH v1 00/13] ntfs: add large folio support for ordinary files Baolin Liu
2026-12-03  4:03 ` [PATCH v1 01/13] ntfs: limit writeback allocation to the dirty range Baolin Liu
2026-12-04 18:45   ` Ernest Borowski [this message]
2026-12-05 10:29     ` liubaolin
2026-12-03  4:03 ` [PATCH v1 02/13] ntfs: read compression units without the block device page cache Baolin Liu
2026-12-03  4:03 ` [PATCH v1 03/13] ntfs: snapshot resident data for direct reads Baolin Liu
2026-12-03  4:03 ` [PATCH v1 04/13] ntfs: allow vmalloc for large runlist backups Baolin Liu
2026-12-03  4:03 ` [PATCH v1 05/13] ntfs: preserve delalloc reservations when allocating holes Baolin Liu
2026-12-03  4:03 ` [PATCH v1 06/13] ntfs: serialize delalloc reservations with cluster allocation Baolin Liu
2026-12-03  4:03 ` [PATCH v1 07/13] ntfs: respect space reservations when writing compressed data Baolin Liu
2026-12-03  4:03 ` [PATCH v1 08/13] ntfs: keep space for MFT growth during delayed allocation Baolin Liu
2026-12-03  4:03 ` [PATCH v1 09/13] ntfs: serialize compression changes with file access Baolin Liu
2026-12-03  4:03 ` [PATCH v1 10/13] ntfs: complete compressed reads at folio granularity Baolin Liu
2026-12-03  4:03 ` [PATCH v1 11/13] ntfs: stop compressed reads at EOF within a base page Baolin Liu
2026-12-03  4:03 ` [PATCH v1 12/13] ntfs: preserve large folios during compressed writes Baolin Liu
2026-12-03  4:03 ` [PATCH v1 13/13] ntfs: enable large folios for ordinary files Baolin Liu
2026-12-03  4:23 ` [PATCH v1 00/13] ntfs: add large folio support " liubaolin
2026-12-03  5:30   ` Namjae Jeon
2026-12-03 10:10     ` liubaolin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179640993906.154108.3521906504217124720.b4-reply@b4 \
    --to=ernest.borowski.git@proton.me \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin12138@163.com \
    --cc=liubaolin@kylinos.cn \
    --cc=ntfs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®