From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.178 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796346359; b=FfJotJpV1G93QI+4oAlJKTjBhyQUo5yV0oIX84FXzJ+ra7wwqfkPNCs1mzjM/izj+5VT +Xg1jD/Xki2J6ogJdEYB/Ep9PYrZSzBjP5joeF9gMPpHVbpqgb7OmnQ/jrQrCfJ9UHvsm UDr79RpBaAxSbUyMjrakdD7ace1svy6rCb6nnrzSSbll478H50pbbzdOTjmUc4te7c30n afunGp1XZ8QU2tC7bfBWgBeGb2939C3jLwlREgKt5OIIm5sPycEwT0aquRtPaGnTmfRe8 9O1Xkepyp74jgJt8PLaJbsdDtGZCh42V375OAghWf1MgUAWpNZJaqb5qH3w8RWm2Nww== 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=g4Apqxia4gMNJwUzwgpxGd6slyBGSxmHXQ2FFZCqFEbJ1wMMvOkXwMqYOpwmnVH9XDka yU/5VwSjbWXu5K/2FlgBx6pLyGb2d7LnFhj1vF3S5bMTrLMPYTreRdEas+Ok353tQU6gk Yl4o1DCOyJSVfhr5Zl0b5eFYyTe/K+rhqgTS3oT66uLXUqOmGqqsa4JHf7Csh6QxDSX9u yPBGiA3ykeVqudlvLjX2e30nyX5m+shFg7oBXPxDei9OFDLq9rpc58no/KjatJz6WvwCZ 951o6muUqd8Rsa4BNDu3VghUCmJoPdaFRl6gbX7cVj0l1vupnNWhP7LmOWYITKbiK+g== 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.210.178 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 553F6606A322 for ; Fri, 4 Dec 2026 01:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 553F6606A322 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-pf1-f178.google.com with SMTP id d2e1a72fcca58-8c6c06b3321so76792b3a.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=EfQXDFSzUKK47ICdYhdw/WcQ/ThR1ubLlm6+hykU0oIqMD5RW8ODiXWZer1+tIr2Vd 5c3m8viVzbvFSORTCQ8zOGpXiHt/gf4fJimizVbZUQl/mgE0zWb2nlAx7kxHbvSMlJAh BitHiy+xlt3lnwKWtc/Lwr+peO+vPsRZmm/vHgK+PenJipyW0ZJMYmo09Vash9iqk1/1 tt8L0NEg8ylKcL7dT58ID8OcMCdnFQ5/hwYVgFPfu1RXnfgkKEnM6J4dsZv7x0+Kz7rh x/2awCsXAjjK/4pwDuziA7JGJBzKewYuGziSAhEwW+o/oz9gpXNi/UFDfOPh0/bd2nq3 QC8g== X-Forwarded-Encrypted: i=1; AL+hErGpj2MYpGWzIvarvEKRNq0skdrXVurHaOQDOS4ekNdydpfzTKwqx4yiEgwSugSu8+Pqk2i7jns=@vger.kernel.org X-Gm-Message-State: APuU4Z84nS414JP5WRZ6vQBd0PktDRC8LGTwlhWEcXQNMrrPiEnp0ckF Lc74nf6w/G8Dm9m9dZNFizXuFzyuwLGWf8toah1V5bJxnB2U+rUwLzWz X-Gm-Gg: AZFdTZfw7j7y81LqkT/9Acr+ENpwJ0NvGT41oAa3Sd0tkSKU2rDl62S34g357My1uh8 s3R8T8llJ2RjWL0HSW1VHHH+lLK/kSbVvjcCE2WaTXTI6yiSSIXmHBeCcKL1y71p0PW5D/kRFaZ BlzeNXS4hdoTAIUDUKHo9OKcZs6NaXM6byaKZfi5R5XyH7kTEmqEypaKt6hoBH1wsd0bNKBakf4 EMgujf2TUei6ektQsE/oiam/cUddvDx3z8Cyhgzd+ojMHMZEtDeu/bdUo1RU1VRdZk3XC50T3kJ JpdP1OpxKMMn0vhcmTF5i8zAinL0PQoqdohmFgcsZTW7gY6j5kDBANPTyi21GApSc2W9xHx3w/L donir+6ias68wvsPgizRYLDLKKvvh0A6VoiKaphmi+28oOwdxTBu9LKAvHo9ARnCOnXVxXxlBvK y1A1nDCekiCUNS0HbVZEyRqI0f2baVppLb7WvFDbXqnM8/XjxgIVtKFOWOVowyBuxVj1hE4RmM8 c6fJvHa0QIVqMqtqMLNahUvjbo1VdA/iDLZh290n7SdaXTa/RBx21GuaJC3D/VrSPEUa+3iplGA wgV78Sps5msbWTaLiQ== 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: stable@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