nilfs2: convert ifile to use kmap_local
authorRyusuke Konishi <konishi.ryusuke@gmail.com>
Mon, 22 Jan 2024 14:01:57 +0000 (23:01 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 22 Feb 2024 23:38:53 +0000 (15:38 -0800)
Convert deprecated kmap() and kmap_atomic() to use kmap_local for the
ifile metadata file used to manage disk inodes.

In some usages, calls to kmap_local and kunmap_local are split into
different helpers, but those usages can be safely changed to local thread
kmap.

Link: https://lkml.kernel.org/r/20240122140202.6950-11-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/nilfs2/ifile.c
fs/nilfs2/ifile.h
fs/nilfs2/inode.c
fs/nilfs2/segment.c

index a8a4bc8490b4d8e8fa7ee62adfda33e600e2ed13..e9538fa46ff27d2f1c22bdbc91129e51602c9d10 100644 (file)
@@ -115,11 +115,11 @@ int nilfs_ifile_delete_inode(struct inode *ifile, ino_t ino)
                return ret;
        }
 
-       kaddr = kmap_atomic(req.pr_entry_bh->b_page);
+       kaddr = kmap_local_page(req.pr_entry_bh->b_page);
        raw_inode = nilfs_palloc_block_get_entry(ifile, req.pr_entry_nr,
                                                 req.pr_entry_bh, kaddr);
        raw_inode->i_flags = 0;
-       kunmap_atomic(kaddr);
+       kunmap_local(kaddr);
 
        mark_buffer_dirty(req.pr_entry_bh);
        brelse(req.pr_entry_bh);
index 35c5273f48219bbfd7b196b68cbea5e6e0a5ae8d..b71ab0a81dc45e48124985c326c6116ab727c7f8 100644 (file)
 static inline struct nilfs_inode *
 nilfs_ifile_map_inode(struct inode *ifile, ino_t ino, struct buffer_head *ibh)
 {
-       void *kaddr = kmap(ibh->b_page);
+       void *kaddr = kmap_local_page(ibh->b_page);
 
        return nilfs_palloc_block_get_entry(ifile, ino, ibh, kaddr);
 }
 
-static inline void nilfs_ifile_unmap_inode(struct inode *ifile, ino_t ino,
-                                          struct buffer_head *ibh)
+static inline void nilfs_ifile_unmap_inode(struct nilfs_inode *raw_inode)
 {
-       kunmap(ibh->b_page);
+       kunmap_local(raw_inode);
 }
 
 int nilfs_ifile_create_inode(struct inode *, ino_t *, struct buffer_head **);
index b9d40f5e94d32aa37d6efda376e24b364e1c0ae6..a475095a5e80b75bf7011c19fa601e56e7c48b8c 100644 (file)
@@ -520,7 +520,7 @@ static int __nilfs_read_inode(struct super_block *sb,
                        inode, inode->i_mode,
                        huge_decode_dev(le64_to_cpu(raw_inode->i_device_code)));
        }
-       nilfs_ifile_unmap_inode(root->ifile, ino, bh);
+       nilfs_ifile_unmap_inode(raw_inode);
        brelse(bh);
        up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
        nilfs_set_inode_flags(inode);
@@ -529,7 +529,7 @@ static int __nilfs_read_inode(struct super_block *sb,
        return 0;
 
  failed_unmap:
-       nilfs_ifile_unmap_inode(root->ifile, ino, bh);
+       nilfs_ifile_unmap_inode(raw_inode);
        brelse(bh);
 
  bad_inode:
@@ -814,7 +814,7 @@ void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags)
                raw_inode->i_device_code =
                        cpu_to_le64(huge_encode_dev(inode->i_rdev));
 
-       nilfs_ifile_unmap_inode(ifile, ino, ibh);
+       nilfs_ifile_unmap_inode(raw_inode);
 }
 
 #define NILFS_MAX_TRUNCATE_BLOCKS      16384  /* 64MB for 4KB block */
index 9044596813cc894fe5974950a0ffcc4c1245790e..7faefeb59040727b9086b3b5aa7cf121c8988e63 100644 (file)
@@ -966,7 +966,7 @@ static void nilfs_fill_in_file_bmap(struct inode *ifile,
                raw_inode = nilfs_ifile_map_inode(ifile, ii->vfs_inode.i_ino,
                                                  ibh);
                nilfs_bmap_write(ii->i_bmap, raw_inode);
-               nilfs_ifile_unmap_inode(ifile, ii->vfs_inode.i_ino, ibh);
+               nilfs_ifile_unmap_inode(raw_inode);
        }
 }