From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796346359; b=L15a4fk/El+5pYWJReQ7YsOqxYFTsR85jVLELDeUmpoMeEijhHN9bDNeYzNVuNjFM1wN P74G9xH7zRFDTW47Ml2OJLAWh8+jJqIfAYC+pOUJOypWK38SukMVIiQ577TUgPE8RtPtY OWDFNqgLCcSA1uQ4wmMKcEGp0jMZMexn/h4x9wDicq6CRR8TieVW3BUuBdE/t469TRTY7 qfeuagdycGTuFgQXzhvTQMTIIKBTrEB4uZ+u3qIPOkmaOfQEpr/XK6y39JMzCB+ndmyvT E/hFL/EoBYlOSYOLd2JpAH3+t6zUyUvxCjDisVLXQl+yNjOA/fkb55ii31RFCDIlvoQ== 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=A2hAr5gd/l4n+TDq8uoFVcnPGPwyrwsoOfmc89yFXUIg66VW3AE8rgzvNn8Ccdx9IDkT HNBSoxyj6IKbvc64rvYlV5tb8x3lIERYsnlSYmAWeJVGOSXXFz9RhUunHoSRapKNOwilg UqQAKl1VMaUR4gABH0Fj6UrsmOANN/qLvdaEvjr5o6TH7qBo2gtHa448Co2QRBFTBX66A hbFHdBH9zfic/JPpwR9cPJXF+44XhYcHiEwZxcl+OJZ1O4a3szi9arb69Ed+GjGwRzVfW /HTRvkIU+UgY0ZbXTQAyHsQDSCSY30OHfVGNLFLiRsWLJeFz7XGaPKmyKjNLmp7Y1cA== 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="jG7lUi7/"; arc=none smtp.remote-ip=209.85.216.47 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (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 5E754606A32D for ; Fri, 4 Dec 2026 01:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5E754606A32D 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=jG7lUi7/ Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-3b51a9606e8so132291a91.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=1796346359; x=1796951159; 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=jG7lUi7/PsDkyB8uODkafPNaUNr4kb55SI8iiPe/JagaHgwBAwcueCbqyP/OPD0s9j QVZQUSUCm0X088nSt28MVryxBZCsG4yCM4p+6lqf/S3IPoONO4oLxLMmtj4v69EdewLj 2tNz0D9urpeo8/QFMf1R01QVQsMxP46S/yyMTjea4SbD6VTaR1eWdLL0al9OVaPdthaB w2hrP73RKsWCBkO9XuZmi1xycKfRqX5KD7CPV9wub158YJ1qse82Pb0RPVuw7kWn5fT/ RLxjECch1cS2EUmTjwZP00xb8BqaLX5SAX31QqOux8ZQ9tqRMhQQLZbxzNnUvbVJ7t1o e7yQ== 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=HCFzuJxqDL1f2s2a0BKmnwoeyC57rIvpaH2W76ZvDF6FRVfa/bP6CTwZPWet+pqh9O M7Xr3eqwffo5EGWuQvN0LhXzCQrzIKJmIWumrkLEfsJTKc9KuCbrkw1cVKrMrqic+cVt j5wjAdZLUM9zXdr1+C2ZZxqzq968ssKlmgGiXbZuNoySLtmZnGx9Y0fss5Jj07h90Rb+ 9ekPu6+qeJnUpvfM/UQFQd0wfBKTrP83Oh5hvaBLf+WniiKMnj8W/DU/+fVakytStPVp Oq9gP4BbXJ7nPwWQc/Fnf2spZJ1gNAWQP+KXUaKL2yfKZLOpf1SOJ+R1ZQL988CSvTRa UwZg== X-Forwarded-Encrypted: i=1; AL+hErG1t5SbuOonpcmfdcI0h9/2zgaeMVvTgJVmq/N+tCVzhvr1K0SlT/LWCz8sYN90PZP4jczuIbvGtXcSpjQ=@vger.kernel.org X-Gm-Message-State: APuU4Z/wwAyhZoff/IxzwR6F0EPQJkez/WNSoOyp4RtoUt9v063fsRs/ KsikvvNw7MB4iVx3y+g1/PwhLmK/rDwpFc4f2foBYgY2FQuqeHS6X1ut X-Gm-Gg: AZFdTZdE7Bm+pF7wUpywMSBiwYBSfo+dSwZNzFSlayfURK3ZebSWFOpEgK+/WgGDK7c suZQZ5Y7vkkeD5ISXZr3aqLCPCm5CEO1M8Ryu6gZukjlOLa0tFDC38+wRc+typffhSbxBiEXC/B IUDx6oWfZ7bJrNiajLiK2L1m+3CCZA/axoGRfP3aIWIy18UvTMATj1BhuLoGjOBJk+hwjzSqvxr X30k9B7vnfLmIQHwFPSPwOl9a+VOXlW3rJWrF84A62w1HkS+jUtbvzhQ0W5exzUyVUGIOlxQtpg 8Y5ETqlDzPoeCdjx8hM2w+DyUzClhx6nFc0in3wS5swMycv30DPCMz5hpmfJk6ibXVhaYSdb3Et MRDWy9MDY1I3xYzHoUHIvz7xtMTAUWQOcinkCNpqxtoB7ijCBVC+wsbk2tJBNc3GjE2BoSEE0ki 1VokLcElqnNo+Gy4Llyd3ewBbvDXHROij7dRdFwZOAsohtZzqxwH8HAG+plEz/xUDmH81cXUlPo RJnYr6+NV4d8A1pnb+GPO5ggl8jpUzoA58e8pj9smL1LG/7ZnlT6oPGzHxLLx0ho/B7ZMa9UD8K FUFU6PkxI1wSpw/ZPg== 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-kernel@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