diff options
author | Ryusuke Konishi <konishi.ryusuke@gmail.com> | 2024-01-22 23:02:00 +0900 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-02-22 15:38:53 -0800 |
commit | 1244a6d7a2c1de669f9682e8a0bd46a53c3be233 (patch) | |
tree | 3935275b9db3fb90251505975ad34e8d1e9d8226 /fs/nilfs2/ifile.c | |
parent | cce259b4c3b13a82541992c56f9c8238451da859 (diff) | |
download | lwn-1244a6d7a2c1de669f9682e8a0bd46a53c3be233.tar.gz lwn-1244a6d7a2c1de669f9682e8a0bd46a53c3be233.zip |
nilfs2: localize highmem mapping for checkpoint reading within cpfile
Move the code for reading from a checkpoint entry that is performed in
nilfs_attach_checkpoint() to the cpfile side, and make the page mapping
local and temporary. And use kmap_local instead of kmap to access the
checkpoint entry page.
In order to load the ifile inode information included in the checkpoint
entry within the inode lock section of nilfs_ifile_read(), the newly added
checkpoint reading method nilfs_cpfile_read_checkpoint() is called
indirectly via nilfs_ifile_read() instead of from
nilfs_attach_checkpoint().
Link: https://lkml.kernel.org/r/20240122140202.6950-14-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/nilfs2/ifile.c')
-rw-r--r-- | fs/nilfs2/ifile.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c index e9538fa46ff2..612e609158b5 100644 --- a/fs/nilfs2/ifile.c +++ b/fs/nilfs2/ifile.c @@ -15,6 +15,7 @@ #include "mdt.h" #include "alloc.h" #include "ifile.h" +#include "cpfile.h" /** * struct nilfs_ifile_info - on-memory private data of ifile @@ -173,14 +174,18 @@ int nilfs_ifile_count_free_inodes(struct inode *ifile, * nilfs_ifile_read - read or get ifile inode * @sb: super block instance * @root: root object + * @cno: number of checkpoint entry to read * @inode_size: size of an inode - * @raw_inode: on-disk ifile inode - * @inodep: buffer to store the inode + * + * Return: 0 on success, or the following negative error code on failure. + * * %-EINVAL - Invalid checkpoint. + * * %-ENOMEM - Insufficient memory available. + * * %-EIO - I/O error (including metadata corruption). */ int nilfs_ifile_read(struct super_block *sb, struct nilfs_root *root, - size_t inode_size, struct nilfs_inode *raw_inode, - struct inode **inodep) + __u64 cno, size_t inode_size) { + struct the_nilfs *nilfs; struct inode *ifile; int err; @@ -201,13 +206,13 @@ int nilfs_ifile_read(struct super_block *sb, struct nilfs_root *root, nilfs_palloc_setup_cache(ifile, &NILFS_IFILE_I(ifile)->palloc_cache); - err = nilfs_read_inode_common(ifile, raw_inode); + nilfs = sb->s_fs_info; + err = nilfs_cpfile_read_checkpoint(nilfs->ns_cpfile, cno, root, ifile); if (err) goto failed; unlock_new_inode(ifile); out: - *inodep = ifile; return 0; failed: iget_failed(ifile); |