Linux NILFS development
 help / color / mirror / Atom feed
From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 10/15] nilfs2: convert ifile to use kmap_local
Date: Mon, 22 Jan 2024 23:01:57 +0900	[thread overview]
Message-ID: <20240122140202.6950-11-konishi.ryusuke@gmail.com> (raw)
In-Reply-To: <20240122140202.6950-1-konishi.ryusuke@gmail.com>

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.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
---
 fs/nilfs2/ifile.c   | 4 ++--
 fs/nilfs2/ifile.h   | 7 +++----
 fs/nilfs2/inode.c   | 6 +++---
 fs/nilfs2/segment.c | 2 +-
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c
index a8a4bc8490b4..e9538fa46ff2 100644
--- a/fs/nilfs2/ifile.c
+++ b/fs/nilfs2/ifile.c
@@ -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);
diff --git a/fs/nilfs2/ifile.h b/fs/nilfs2/ifile.h
index 35c5273f4821..b71ab0a81dc4 100644
--- a/fs/nilfs2/ifile.h
+++ b/fs/nilfs2/ifile.h
@@ -21,15 +21,14 @@
 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 **);
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index b9d40f5e94d3..a475095a5e80 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -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 */
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index b512e7728465..3657918328ea 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -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);
 	}
 }
 
-- 
2.34.1


  parent reply	other threads:[~2024-01-22 14:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 14:01 [PATCH 00/15] nilfs2: eliminate kmap and kmap_atomic calls Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 01/15] nilfs2: convert recovery logic to use kmap_local Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 02/15] nilfs2: convert segment buffer " Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 03/15] nilfs2: convert nilfs_copy_buffer() " Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 04/15] nilfs2: convert metadata file common code " Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 05/15] nilfs2: convert sufile " Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 06/15] nilfs2: convert persistent object allocator " Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 07/15] nilfs2: convert DAT " Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 08/15] nilfs2: move nilfs_bmap_write call out of nilfs_write_inode_common Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 09/15] nilfs2: do not acquire rwsem in nilfs_bmap_write() Ryusuke Konishi
2024-01-22 14:01 ` Ryusuke Konishi [this message]
2024-01-22 14:01 ` [PATCH 11/15] nilfs2: localize highmem mapping for checkpoint creation within cpfile Ryusuke Konishi
2024-01-22 14:01 ` [PATCH 12/15] nilfs2: localize highmem mapping for checkpoint finalization " Ryusuke Konishi
2024-01-22 14:02 ` [PATCH 13/15] nilfs2: localize highmem mapping for checkpoint reading " Ryusuke Konishi
2024-01-22 14:02 ` [PATCH 14/15] nilfs2: remove nilfs_cpfile_{get,put}_checkpoint() Ryusuke Konishi
2024-01-22 14:02 ` [PATCH 15/15] nilfs2: convert cpfile to use kmap_local Ryusuke Konishi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240122140202.6950-11-konishi.ryusuke@gmail.com \
    --to=konishi.ryusuke@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nilfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox