nilfs2: remove page_address() from nilfs_set_link
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 27 Nov 2023 14:30:22 +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, use
offset_in_page() to calculate 'from'.  Matches ext2.

Link: https://lkml.kernel.org/r/20231127143036.2425-4-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 b9f13bdf8fbaa249bc706d9ef15c8468785cb4c7..9c0513245a3b48d7da071dafc75a59019b4fcd6d 100644 (file)
@@ -410,7 +410,7 @@ ino_t nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr)
 void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
                    struct page *page, struct inode *inode)
 {
-       unsigned int from = (char *)de - (char *)page_address(page);
+       unsigned int from = offset_in_page(de);
        unsigned int to = from + nilfs_rec_len_from_disk(de->rec_len);
        struct address_space *mapping = page->mapping;
        int err;