From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796346359; b=h/RfZ539xGAoJpaoePCG6Ec1gAf/QzlQwhsoiAZL9Xee8b02y0t/hyyo6hh5ps1vpZc5 TGwUouma/gj/v23A1ofkAFw92xLVhBJk49hxSQ/QVCa1NvNfEQg+d26mP5zIyxsFCeMDa o/HL93A+KtA6c1NbecIR9Tg//T94r6CN7JbNG+W+Kg7Y+uuvPYVEZPbADn3jwZchhGw27 e+dEryDHt+1izn4wLmLBlxTniC3jGmHa4UMtTEVc3aUscT2SS+Q8rCSz1xU1kMRcL/OwJ BFs7i6aIuBsJ0n2TJM8H6nk40o5vA3+tsIX8U1gSJ7Yyd38CyzfOlrW2oWNKiPPZq6g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796346359; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=WcSyvFCnz+JQrKoLf9yoiRKGxcNHCXmL45OLmKcUbi4=; b=AJaU9EaUHbn2+MD1cH+/nn00mH7jbCOQeWrfhM26YcMdUqyNVTQyf0XdFidVRkoAnLus lNM2FsQ91ysytryHK42jtoHC6TlRRHeNmlwa12wXsuo876p+/IUUcSGVyCj3WExrJ2kBo 1LFJ7gzIfgSgipI2aCdaEvs/KTNNH+Y3Oqtkpl+b78MT/IQ1iQPTfU+rnLWh2ha/cTlDe tQoFn/mVIUi3R19OFHqr9kZizmVzMznIG9Vbx0LVh5mk7cnl/Lc4cr3YCfuAG2SPBGcWF h5qBRGzhmiqC33JpCThUqz9/z5d3/fzsbBoNxyN023fLQx6RKvhQcWeJLLJDJvcmjlw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wx5OiveJ; arc=none smtp.remote-ip=209.85.216.46 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F6F9606A32F for ; Fri, 4 Dec 2026 01:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5F6F9606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wx5OiveJ Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-3b51a9606e8so132290a91.3 for ; Thu, 03 Dec 2026 17:05:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796346358; x=1796951158; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WcSyvFCnz+JQrKoLf9yoiRKGxcNHCXmL45OLmKcUbi4=; b=wx5OiveJ8O4sOotNwXjjv8UWhcN9WPQ19FkbKzkwXq5kUbbEWJFigOPwHAMmRl4LKy kYnwx4CEpqL/QY2hJmz7uJw0aIZH1Ofq4TutQ1cXSIe6W8/su9x/o9QrkQYEkq6LVILG 3n6gVNZEW7j7dFuppTXAeP4AEOLPZaGmaiq3Ul7sn8fvsvZSGOm0yr3d/Q+Mf5SrMY// +OargB4+DGPeeXtCBHzSFrQnEjPRsCKPNvPOBDLIK5g29jIiweREtlCqL++4IiDHY7rB SO/peWFOTN64yJ4liq6V7Ait9snLel1aUKCcY21/d4GjFi6nnnHNe3qxe8i6zzB/yCKX lR3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796346359; x=1796951159; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WcSyvFCnz+JQrKoLf9yoiRKGxcNHCXmL45OLmKcUbi4=; b=GExSKD3N3nl/tdJ8svwPGG/1XKq0Qi5Q8fvK6Uf03Hp7A4fkUQijTM4EPoN4lR1Ytn VI6dL1DdrVYXhSCuBdIEYRCFdHhaB7KmMkRIkuWww5DPrGqWqhckMMNxMfypvjoNI2QA wVGSZWpYwZDnpCTl0EWR0N0f/gT19y5qrJr2LRbDvzmd7Uf5nufjSspLQk+6iKD8iobh u6X7ULFMjHs26/Spu46bSQtU63Wxbpq5U5+qqai36DzWodjnMVBhFgnGLvsfXCAtGVQJ mmCMatW3DA4hd8IGOrAkWLPLKXs58xmK+kPTBpSLqxf11POqAtz5CJC6ZD0VTLXO2IXU 8+UQ== X-Forwarded-Encrypted: i=1; AL+hErH2LRlnTZ2/FJ4iZ3njPjeZrC33PQi5jkw3zJJCyXIIRZMU2by2dedt/96ceDHnN2D5gMrbNC9k44ZxKfED@vger.kernel.org X-Gm-Message-State: APuU4Z/dT/FxndRdu+eu+Ez9d7ZH/h71rO3WdJGlhlgj++Aqu27x6ITW Z7bjA6FgL1TAjGy3tQisCcdz4xeaKebhhQDiCR4B4JSZlrlHVEWy9M9R X-Gm-Gg: AZFdTZfkqY3weK0BOmhJZW7leMiBNv+W9E083wY8uhALsIqtS5BnnSvMDHbAFVAo7v5 wk4BfcxD0a7IEf8KOnu4EF3DoaSJVDlwPPcIE61g5vzQ5WeN5ntiCE6cg9iOLNo+gE9y8HXvZHd n3HhJItN7ZuWpcCYjdLI65XJD43CDx8GSeqNq19lVLG/KYHnuV1bp/U2qxbx00bGOCjM7yNGv2L scKeSOfVjhzIdGyoSalKZyGUsaqHEZELX6+4w2zR4s29DFnaHRGzt8/IVC5fIG/Uhjosj1e6XbT cuuNQU4xa5gQipFSuE4ep8NTEkh7tRKZKNw3qWia+PGDUQ2GNNUcP75xaSvc6YtyoAxxnKLU4M5 78uoAoZA5MS+X/qiKtoWr42B8trgG1BDFGfNv7m/v5Ie5ufFdCpNJDj+FPqmdTUuaLJt8a/uraX iVVsBgJ6ayu8dWhuaCDntecRQA2XIs+XwMUIZzIWM5tp6C1CBvo1Oousg9zFQKkUP3xe0AaxMfj 4ps8/Ne3KqVID1Chcab2gz0Lxi4bxw4/43fuUszI8DIei2gPdxC8HAFrTGmzzUxQ194dKNzroKY 0jKos8yofwxwrAgpSA== X-Received: by 2002:a17:90b:57ce:b0:3b3:fe22:2745 with SMTP id 98e67ed59e1d1-3b5e0684d50mr290407a91.45.1796346358575; Thu, 03 Dec 2026 17:05:58 -0800 (PST) Received: from localhost ([27.122.242.71]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d78d88sm6836735a91.13.2026.12.03.17.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 17:05:57 -0800 (PST) Date: Fri, 4 Dec 2026 10:05:55 +0900 From: Hyunchul Lee To: ernest.borowski.git@proton.me Cc: Namjae Jeon , Baolin Liu , Christian Brauner , Christoph Hellwig , "Darrick J. Wong" , ntfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, Zhan Xusheng , stable@vger.kernel.org Subject: Re: [PATCH v4 10/11] ntfs: zero the rest of a new cluster after a short buffered write Message-ID: References: <20261201-b4-ntfs-delalloc-fixes-v4-0-e5dd6f77016a@proton.me> <20261201-b4-ntfs-delalloc-fixes-v4-10-e5dd6f77016a@proton.me> X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261201-b4-ntfs-delalloc-fixes-v4-10-e5dd6f77016a@proton.me> Hi Ernest, > +/* > + * Make writeback write all of [start, end), the rest of a cluster that was a > + * hole and that a short buffered write filled only in part. Folios in the > + * page cache keep their contents (the zeroes __iomap_write_begin() put > + * there, or data an mmap write added meanwhile), and only their blocks in > + * the range are dirtied: other clean blocks of the folio may be holes, or > + * delalloc clusters the write did not reach, which the caller punches out. > + * The rest of the range is zeroed only while the cluster is still delalloc: > + * once a write fault or writeback has allocated it, what an mmap write put > + * there since may be on the disk only, and zeroing the page cache would > + * overwrite it. The caller holds the invalidate lock. > + */ > +static int ntfs_dirty_cluster_tail(struct inode *inode, loff_t start, > + loff_t end) > +{ > + struct folio *folio; > + loff_t next; > + int err = 0; > + > + lockdep_assert_held_write(&inode->i_mapping->invalidate_lock); > + while (!err && start < end) { > + folio = filemap_lock_folio(inode->i_mapping, > + start >> PAGE_SHIFT); > + if (IS_ERR(folio)) { > + next = min_t(loff_t, round_up(start + 1, PAGE_SIZE), > + end); > + if (ntfs_pos_is_delalloc(inode, start)) > + err = ntfs_zero_range_unkillable(inode, start, > + next - start); > + } else { > + bool uptodate = folio_test_uptodate(folio); > + size_t off = offset_in_folio(folio, start); > + > + next = min_t(loff_t, folio_pos(folio) + > + folio_size(folio), end); > + if (uptodate) > + iomap_dirty_folio_range(folio, off, > + next - start); Instead of marking this range dirty directly, how about zeroing it with iomap_zero_range()? __iomap_write_end() marks exactly the zeroed range dirty. if (ntfs_pos_is_delalloc(inode, start)) { ntfs_zero_range_unkillable(...) continue; } folio = filemap_lock_folio(...) if (IS_ERR(folio)) continue; if (folio_test_uptodate(folio)) folio_mark_dirty(folio); ... > + folio_unlock(folio); > + folio_put(folio); > + if (!uptodate && ntfs_pos_is_delalloc(inode, start)) > + err = ntfs_zero_range_unkillable(inode, start, > + next - start); > + } > + start = next; > + } > + return err; > +} > + -- Thanks, Hyunchul