nilfs2: remove page_address() from nilfs_delete_entry
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 27 Nov 2023 14:30:24 +0000 (23:30 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 11 Dec 2023 01:21:45 +0000 (17:21 -0800)
In preparation for removing kmap from directory handling, mask the
directory entry pointer to discover the start address of the page.
Matches ext2.

Link: https://lkml.kernel.org/r/20231127143036.2425-6-konishi.ryusuke@gmail.com
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/nilfs2/dir.c

index 73f1352902880e6c4025d2874a07d4d5938b07c7..385e47eda99f97cf3fc3eb031172ccbd23d0c7ef 100644 (file)
@@ -531,7 +531,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
 {
        struct address_space *mapping = page->mapping;
        struct inode *inode = mapping->host;
-       char *kaddr = page_address(page);
+       char *kaddr = (char *)((unsigned long)dir & PAGE_MASK);
        unsigned int from, to;
        struct nilfs_dir_entry *de, *pde = NULL;
        int err;
@@ -551,7 +551,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
                de = nilfs_next_entry(de);
        }
        if (pde)
-               from = (char *)pde - (char *)page_address(page);
+               from = (char *)pde - kaddr;
        lock_page(page);
        err = nilfs_prepare_chunk(page, from, to);
        BUG_ON(err);