From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796346359; b=1btBPBEWXRy5cY+8UuY7I1xIODAbd86qL8d2CF/LUod/+4gHdmLa4XAAE8YcShXGDelo dyu2fqUgIJxcZJPBXvKjc36TL+IgUf4QjtLjoJhkdncW5bnVs1GLI/KLWhPFqGDQYBViF 2D9sgXs6e6AKsH2KwsdzY1jtibeQz0PzrvYQraupg+3uWZErrRe+TzDS7fa1vlhnlL2DR 1RkrsHBNzBsEcb4zX7xZC49sbJekY6k4kODm9hNzkQZ3ILYRNFsR/IMinI41kJO80HdZX ht0AgNJBm8GmM47f79WFWroVrrEZXJ+okkDsieQxYhnHBU5OEh7+JJi1lYHmCqy2Kyg== 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=bKXFKvDGM7pZN5eJVf3G+t3o+Gtfx3ajjD4VW97PQNHV/imCxnChlrh4+f22nkVT9xAB /QCZr9iFf8oANMDC5qnDbjmaU62Di9rl089lwBP2LnYYRML8KO7t1fIPogixtTumvoUWl j/rYuiY3YUyrovKnHxwyu66tFYNg/PfyDh9xBPz/cDLR+9Q6EEUvAgj0Sfn2c4AoTFcKC ffa6F4hXh+EqngvdrHSuYBmtnQqCS2fclS5qkLMDzBr7S6LflM7sTw3EEXdvxMFhtvrd5 B01E533KbyYAnHhWi0QIDMBVOMVeV7GBhgfOS/xvuYJnxYANQ6t9633tp2GvkNaDmzg== 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.179 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 621C6606A330 for ; Fri, 4 Dec 2026 01:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 621C6606A330 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-f179.google.com with SMTP id d2e1a72fcca58-8c6c06b3321so76793b3a.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=KifoGrEKaUKE+9pq++1SDwY5AYLKMKZ2/riFYkx7lNSZJBfnlYxbBXBr6w6/o/G1hi 6M73T9eL/xMoLJMdla5mC8qMqDSPlxVk1g1LZHG7vTK0rP4SlkvPhJc2Vb3MGk3WNFLM uPwLX696GwCUzLPKTITyp0hrHLJEFg4YG47zGoy393sOY8TnTLj6wd+xB/HQ/fbuxN6u oJgojUnbtFvSBNcTDRTYaruIgAxme8GgncX/nmpTdFJL3WNMG6PBXUV/FhdXkrgq8Xfx asZv6IWzBt7fqyW+YZN3/gIQLjzxhTCzy2wDcVdJnR2+WTmMdTifknrK8Hdwwr7H/zKs iR2g== X-Forwarded-Encrypted: i=1; AL+hErF7/D3LmE86fhEJ+FqGnzMu5+yk7//kh0gsBKFRbm8Zg7TLC+h9fVitqamLhneEJ3fWHZZgfDfqNR4=@vger.kernel.org X-Gm-Message-State: APuU4Z8TyY3R1D7m5IjfuH2/sFtyIfy3OvJaFROKt/qgdz4yenIz4h9v MtEOB/WLkKUYK/uHJOGHK+Ze/yGeKilxhi+C/bwVwR4q0iHsY1Plojsy X-Gm-Gg: AZFdTZeqaSjZ9g6roRX1G9KL/Ue+13liB3nznRxLLf6ldpv/FveDO0mZSgBSv4vwISX IflNY3YyF6TrsYZJYoRR+a3bi2JYi8jZwqkUJfsmk4m+OsynMPn0QDjYKURvWghzcX2sHRPyfLm v5oSJxGCEM5h6lBwu/+b69/ga4aXmO1zKRD8igsO4/ORIHdETLW+aerJ9uetYDRgBKeEuu62zXZ ba0MhLBNfoDcw61Y+uURujZK/+Rc42poizOey+OnemskifKeNwbEUKzTj5PflSBvcWblpSI3np2 /7j7dbLJ7XRJz1pYuEwn38R44BLYv4ASCWcVrfCz1APW+d5cxlfPsTm+jdI10MUbk0j0SfJ2LHK MbYk01YYPakJkqY1hRxH5EoTFOdpPmspEC7CtOQYWV19ikulWLvrtONynLVq679cwoJGDutqWDb lJEY+uSQgosw5q19ADddCGNwbf1w9xLFL4zu/JnfywKn39qGIXVts7QZjPyIo/r0y5Jl1GB5NfW kM5rJKesPWlWGAZOAgjAMlgJX2ITUNU/Qqhm7ll+6fOfjrYtmZbNyGMIisBKMkiO6t0IWYkxryR On8hgPf19+ANVWV7yw== 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-xfs@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