[PATCH v3 2/4] ntfs: Remove use of __folio_index in handle_bounds_compressed_page()

Hyunchul Lee <[email protected]> Wed, 15 Jul 2026 10:38:01 +0900
Newsgroups dev.linux.lists.ntfs,org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
From: "Matthew Wilcox (Oracle)" <[email protected]>

Nobody is supposed to use page->__folio_index.  Use page_offset()
instead, and simplify by working exclusively in loff_t instead of mixing
up loff_t and pgoff_t.

Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Co-developed-by: Hyunchul Lee <[email protected]>
Signed-off-by: Hyunchul Lee <[email protected]>
---
 fs/ntfs/compress.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c
index c904858dff3d..8078041b8796 100644
--- a/fs/ntfs/compress.c
+++ b/fs/ntfs/compress.c
@@ -105,13 +105,15 @@ void free_compression_buffers(void)
 static inline void handle_bounds_compressed_page(struct page *page,
 		const loff_t i_size, const s64 initialized_size)
 {
-	if ((page->__folio_index >= (initialized_size >> PAGE_SHIFT)) &&
+	loff_t pos = page_offset(page);
+
+	if ((pos + PAGE_SIZE > initialized_size) &&
 			(initialized_size < i_size)) {
 		u8 *kp = page_address(page);
 		unsigned int kp_ofs;
 
 		ntfs_debug("Zeroing page region outside initialized size.");
-		if (((s64)page->__folio_index << PAGE_SHIFT) >= initialized_size) {
+		if (pos >= initialized_size) {
 			clear_page(kp);
 			return;
 		}

-- 
2.43.0