Re: [PATCH] nilfs2: standardize the inode number type to u64
From: Viacheslav Dubeyko
Date: Mon Aug 10 2026 - 19:09:33 EST
On Tue, 2026-08-11 at 02:48 +0900, Ryusuke Konishi wrote:
> Variables handling inode numbers - such as the 'i_ino' member of the
> inode structure - have been converted to 'u64' within the kernel to
> ensure consistency. However, some parts of the nilfs2 implementation
> still use 'ino_t' or 'unsigned long' - both of which are
> architecture-dependent types - to handle inode numbers.
>
> Replace those remaining instances of 'ino_t' or 'unsigned long' with
> 'u64'.
>
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxx>
> ---
> Hi Viacheslav,
>
> Please apply this for the next cycle.
>
> Following the treewide conversion of inode numbers to 64-bit, this
> cleans up the remaining architecture-dependent types in the nilfs2
> implementation, standardizing them to 'u64'.
>
> Thanks,
> Ryusuke Konishi
>
> fs/nilfs2/dir.c | 11 +++++------
> fs/nilfs2/ifile.c | 13 ++++++-------
> fs/nilfs2/ifile.h | 10 ++++++----
> fs/nilfs2/inode.c | 24 +++++++++++-------------
> fs/nilfs2/ioctl.c | 2 +-
> fs/nilfs2/namei.c | 6 +++---
> fs/nilfs2/nilfs.h | 15 +++++++--------
> fs/nilfs2/page.c | 9 ++++-----
> fs/nilfs2/recovery.c | 4 ++--
> fs/nilfs2/segment.c | 2 +-
> 10 files changed, 46 insertions(+), 50 deletions(-)
>
> diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
> index 3653db5cdb65..8b53802b6ebd 100644
> --- a/fs/nilfs2/dir.c
> +++ b/fs/nilfs2/dir.c
> @@ -169,17 +169,16 @@ static bool nilfs_check_folio(struct folio
> *folio, char *kaddr)
> error = "disallowed inode number";
> bad_entry:
> nilfs_error(sb,
> - "bad entry in directory #%llu: %s - offset=%lu,
> inode=%lu, rec_len=%zd, name_len=%d",
> + "bad entry in directory #%llu: %s - offset=%lu,
> inode=%llu, rec_len=%zd, name_len=%d",
> dir->i_ino, error, (folio->index << PAGE_SHIFT)
> + offs,
> - (unsigned long)le64_to_cpu(p->inode),
> - rec_len, p->name_len);
> + le64_to_cpu(p->inode), rec_len, p->name_len);
> goto fail;
> Eend:
> p = (struct nilfs_dir_entry *)(kaddr + offs);
> nilfs_error(sb,
> - "entry in directory #%llu spans the page
> boundary offset=%lu, inode=%lu",
> + "entry in directory #%llu spans the page
> boundary offset=%lu, inode=%llu",
> dir->i_ino, (folio->index << PAGE_SHIFT) + offs,
> - (unsigned long)le64_to_cpu(p->inode));
> + le64_to_cpu(p->inode));
> fail:
> return false;
> }
> @@ -387,7 +386,7 @@ struct nilfs_dir_entry *nilfs_dotdot(struct inode
> *dir, struct folio **foliop)
> return NULL;
> }
>
> -int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr,
> ino_t *ino)
> +int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr,
> u64 *ino)
> {
> struct nilfs_dir_entry *de;
> struct folio *folio;
> diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c
> index 99eb8a59009e..c99e1e6356ae 100644
> --- a/fs/nilfs2/ifile.c
> +++ b/fs/nilfs2/ifile.c
> @@ -49,7 +49,7 @@ static inline struct nilfs_ifile_info
> *NILFS_IFILE_I(struct inode *ifile)
> * * %-ENOMEM - Insufficient memory available.
> * * %-ENOSPC - No inode left.
> */
> -int nilfs_ifile_create_inode(struct inode *ifile, ino_t *out_ino,
> +int nilfs_ifile_create_inode(struct inode *ifile, u64 *out_ino,
> struct buffer_head **out_bh)
> {
> struct nilfs_palloc_req req;
> @@ -72,7 +72,7 @@ int nilfs_ifile_create_inode(struct inode *ifile,
> ino_t *out_ino,
> nilfs_palloc_commit_alloc_entry(ifile, &req);
> mark_buffer_dirty(req.pr_entry_bh);
> nilfs_mdt_mark_dirty(ifile);
> - *out_ino = (ino_t)req.pr_entry_nr;
> + *out_ino = req.pr_entry_nr;
> *out_bh = req.pr_entry_bh;
> return 0;
> }
> @@ -88,7 +88,7 @@ int nilfs_ifile_create_inode(struct inode *ifile,
> ino_t *out_ino,
> * * %-ENOENT - Inode number unallocated.
> * * %-ENOMEM - Insufficient memory available.
> */
> -int nilfs_ifile_delete_inode(struct inode *ifile, ino_t ino)
> +int nilfs_ifile_delete_inode(struct inode *ifile, u64 ino)
> {
> struct nilfs_palloc_req req = {
> .pr_entry_nr = ino, .pr_entry_bh = NULL
> @@ -123,21 +123,20 @@ int nilfs_ifile_delete_inode(struct inode
> *ifile, ino_t ino)
> return 0;
> }
>
> -int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino,
> +int nilfs_ifile_get_inode_block(struct inode *ifile, u64 ino,
> struct buffer_head **out_bh)
> {
> struct super_block *sb = ifile->i_sb;
> int err;
>
> if (unlikely(!NILFS_VALID_INODE(sb, ino))) {
> - nilfs_error(sb, "bad inode number: %lu", (unsigned
> long)ino);
> + nilfs_error(sb, "bad inode number: %llu", ino);
> return -EINVAL;
> }
>
> err = nilfs_palloc_get_entry_block(ifile, ino, 0, out_bh);
> if (unlikely(err))
> - nilfs_warn(sb, "error %d reading inode: ino=%lu",
> - err, (unsigned long)ino);
> + nilfs_warn(sb, "error %d reading inode: ino=%llu",
> err, ino);
> return err;
> }
>
> diff --git a/fs/nilfs2/ifile.h b/fs/nilfs2/ifile.h
> index 5d116a566d9e..d38a46f5ae41 100644
> --- a/fs/nilfs2/ifile.h
> +++ b/fs/nilfs2/ifile.h
> @@ -19,7 +19,7 @@
>
>
> static inline struct nilfs_inode *
> -nilfs_ifile_map_inode(struct inode *ifile, ino_t ino, struct
> buffer_head *ibh)
> +nilfs_ifile_map_inode(struct inode *ifile, u64 ino, struct
> buffer_head *ibh)
> {
> size_t __offset_in_folio = nilfs_palloc_entry_offset(ifile,
> ino, ibh);
>
> @@ -31,9 +31,11 @@ static inline void nilfs_ifile_unmap_inode(struct
> nilfs_inode *raw_inode)
> kunmap_local(raw_inode);
> }
>
> -int nilfs_ifile_create_inode(struct inode *, ino_t *, struct
> buffer_head **);
> -int nilfs_ifile_delete_inode(struct inode *, ino_t);
> -int nilfs_ifile_get_inode_block(struct inode *, ino_t, struct
> buffer_head **);
> +int nilfs_ifile_create_inode(struct inode *ifile, u64 *out_ino,
> + struct buffer_head **out_bh);
> +int nilfs_ifile_delete_inode(struct inode *ifile, u64 ino);
> +int nilfs_ifile_get_inode_block(struct inode *ifile, u64 ino,
> + struct buffer_head **out_bh);
>
> int nilfs_ifile_count_free_inodes(struct inode *, u64 *, u64 *);
>
> diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
> index 51f7e125a311..34e6096069ad 100644
> --- a/fs/nilfs2/inode.c
> +++ b/fs/nilfs2/inode.c
> @@ -287,8 +287,7 @@ const struct address_space_operations
> nilfs_buffer_cache_aops = {
> };
>
> static int nilfs_insert_inode_locked(struct inode *inode,
> - struct nilfs_root *root,
> - unsigned long ino)
> + struct nilfs_root *root, u64 ino)
> {
> struct nilfs_iget_args args = {
> .ino = ino, .root = root, .cno = 0, .type =
> NILFS_I_TYPE_NORMAL
> @@ -305,7 +304,7 @@ struct inode *nilfs_new_inode(struct inode *dir,
> umode_t mode)
> struct nilfs_root *root;
> struct buffer_head *bh;
> int err = -ENOMEM;
> - ino_t ino;
> + u64 ino;
>
> inode = new_inode(sb);
> if (unlikely(!inode))
> @@ -443,7 +442,7 @@ int nilfs_read_inode_common(struct inode *inode,
> }
>
> static int __nilfs_read_inode(struct super_block *sb,
> - struct nilfs_root *root, unsigned long
> ino,
> + struct nilfs_root *root, u64 ino,
> struct inode *inode)
> {
> struct the_nilfs *nilfs = sb->s_fs_info;
> @@ -482,8 +481,8 @@ static int __nilfs_read_inode(struct super_block
> *sb,
> huge_decode_dev(le64_to_cpu(raw_inode-
> >i_device_code)));
> } else {
> nilfs_error(sb,
> - "invalid file type bits in mode 0%o for
> inode %lu",
> - inode->i_mode, ino);
> + "invalid file type bits in mode 0%o for
> inode %llu",
> + inode->i_mode, ino);
> err = -EIO;
> goto failed_unmap;
> }
> @@ -533,7 +532,7 @@ static int nilfs_iget_set(struct inode *inode,
> void *opaque)
> }
>
> struct inode *nilfs_ilookup(struct super_block *sb, struct
> nilfs_root *root,
> - unsigned long ino)
> + u64 ino)
> {
> struct nilfs_iget_args args = {
> .ino = ino, .root = root, .cno = 0, .type =
> NILFS_I_TYPE_NORMAL
> @@ -542,8 +541,8 @@ struct inode *nilfs_ilookup(struct super_block
> *sb, struct nilfs_root *root,
> return ilookup5(sb, ino, nilfs_iget_test, &args);
> }
>
> -struct inode *nilfs_iget_locked(struct super_block *sb, struct
> nilfs_root *root,
> - unsigned long ino)
> +struct inode *nilfs_iget_locked(struct super_block *sb,
> + struct nilfs_root *root, u64 ino)
> {
> struct nilfs_iget_args args = {
> .ino = ino, .root = root, .cno = 0, .type =
> NILFS_I_TYPE_NORMAL
> @@ -553,7 +552,7 @@ struct inode *nilfs_iget_locked(struct
> super_block *sb, struct nilfs_root *root,
> }
>
> struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root
> *root,
> - unsigned long ino)
> + u64 ino)
> {
> struct inode *inode;
> int err;
> @@ -579,8 +578,7 @@ struct inode *nilfs_iget(struct super_block *sb,
> struct nilfs_root *root,
> return inode;
> }
>
> -struct inode *nilfs_iget_for_gc(struct super_block *sb, unsigned
> long ino,
> - __u64 cno)
> +struct inode *nilfs_iget_for_gc(struct super_block *sb, u64 ino,
> __u64 cno)
> {
> struct nilfs_iget_args args = {
> .ino = ino, .root = NULL, .cno = cno, .type =
> NILFS_I_TYPE_GC
> @@ -740,7 +738,7 @@ void nilfs_write_inode_common(struct inode
> *inode,
>
> void nilfs_update_inode(struct inode *inode, struct buffer_head
> *ibh, int flags)
> {
> - ino_t ino = inode->i_ino;
> + u64 ino = inode->i_ino;
> struct nilfs_inode_info *ii = NILFS_I(inode);
> struct inode *ifile = ii->i_root->ifile;
> struct nilfs_inode *raw_inode;
> diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
> index 0957316e58b8..01a04080ef70 100644
> --- a/fs/nilfs2/ioctl.c
> +++ b/fs/nilfs2/ioctl.c
> @@ -612,7 +612,7 @@ static int nilfs_ioctl_move_blocks(struct
> super_block *sb,
> struct nilfs_vdesc *vdesc;
> struct buffer_head *bh, *n;
> LIST_HEAD(buffers);
> - ino_t ino;
> + u64 ino;
> __u64 cno;
> int i, ret;
>
> diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
> index e2fe95de3d71..6a482da7c682 100644
> --- a/fs/nilfs2/namei.c
> +++ b/fs/nilfs2/namei.c
> @@ -54,7 +54,7 @@ static struct dentry *
> nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int
> flags)
> {
> struct inode *inode;
> - ino_t ino;
> + u64 ino;
> int res;
>
> if (dentry->d_name.len > NILFS_NAME_LEN)
> @@ -69,7 +69,7 @@ nilfs_lookup(struct inode *dir, struct dentry
> *dentry, unsigned int flags)
> inode = nilfs_iget(dir->i_sb, NILFS_I(dir)->i_root,
> ino);
> if (inode == ERR_PTR(-ESTALE)) {
> nilfs_error(dir->i_sb,
> - "deleted inode referenced:
> %lu", ino);
> + "deleted inode referenced: %llu",
> ino);
> return ERR_PTR(-EIO);
> }
> }
> @@ -463,7 +463,7 @@ static int nilfs_rename(struct mnt_idmap *idmap,
> */
> static struct dentry *nilfs_get_parent(struct dentry *child)
> {
> - ino_t ino;
> + u64 ino;
> int res;
> struct nilfs_root *root;
>
> diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
> index b7e3d91b6243..4fc42d3787a4 100644
> --- a/fs/nilfs2/nilfs.h
> +++ b/fs/nilfs2/nilfs.h
> @@ -144,7 +144,7 @@ enum {
> ((ino) < NILFS_USER_INO && (NILFS_SYS_INO_BITS &
> BIT(ino))))
>
> #define NILFS_PRIVATE_INODE(ino)
> ({ \
> - ino_t __ino =
> (ino); \
> + u64 __ino =
> (ino); \
> ((__ino) < NILFS_USER_INO && (__ino) != NILFS_ROOT_INO
> && \
> (__ino) != NILFS_SKETCH_INO); })
>
> @@ -255,7 +255,7 @@ static inline __u32 nilfs_mask_flags(umode_t
> mode, __u32 flags)
>
> /* dir.c */
> int nilfs_add_link(struct dentry *, struct inode *);
> -int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr,
> ino_t *ino);
> +int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr,
> u64 *ino);
> int nilfs_make_empty(struct inode *, struct inode *);
> struct nilfs_dir_entry *nilfs_find_entry(struct inode *, const
> struct qstr *,
> struct folio **);
> @@ -287,13 +287,12 @@ extern int nilfs_read_inode_common(struct inode
> *, struct nilfs_inode *);
> void nilfs_write_inode_common(struct inode *inode,
> struct nilfs_inode *raw_inode);
> struct inode *nilfs_ilookup(struct super_block *sb, struct
> nilfs_root *root,
> - unsigned long ino);
> -struct inode *nilfs_iget_locked(struct super_block *sb, struct
> nilfs_root *root,
> - unsigned long ino);
> + u64 ino);
> +struct inode *nilfs_iget_locked(struct super_block *sb,
> + struct nilfs_root *root, u64 ino);
> struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root
> *root,
> - unsigned long ino);
> -extern struct inode *nilfs_iget_for_gc(struct super_block *sb,
> - unsigned long ino, __u64
> cno);
> + u64 ino);
> +struct inode *nilfs_iget_for_gc(struct super_block *sb, u64 ino,
> __u64 cno);
> int nilfs_attach_btree_node_cache(struct inode *inode);
> void nilfs_detach_btree_node_cache(struct inode *inode);
> struct inode *nilfs_iget_for_shadow(struct inode *inode);
> diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
> index 1d00bce21c37..cf4f1c6798f5 100644
> --- a/fs/nilfs2/page.c
> +++ b/fs/nilfs2/page.c
> @@ -154,7 +154,7 @@ void nilfs_folio_bug(struct folio *folio)
> {
> struct buffer_head *bh, *head;
> struct address_space *m;
> - unsigned long ino;
> + u64 ino;
>
> if (unlikely(!folio)) {
> printk(KERN_CRIT "NILFS_FOLIO_BUG(NULL)\n");
> @@ -164,10 +164,9 @@ void nilfs_folio_bug(struct folio *folio)
> m = folio->mapping;
> ino = m ? m->host->i_ino : 0;
>
> - printk(KERN_CRIT "NILFS_FOLIO_BUG(%p): cnt=%d index#=%llu
> flags=0x%lx "
> - "mapping=%p ino=%lu\n",
> - folio, folio_ref_count(folio),
> - (unsigned long long)folio->index, folio->flags.f, m,
> ino);
> + printk(KERN_CRIT "NILFS_FOLIO_BUG(%p): cnt=%d index#=%lu
> flags=0x%lx mapping=%p ino=%llu\n",
> + folio, folio_ref_count(folio), folio->index, folio-
> >flags.f,
> + m, ino);
>
> head = folio_buffers(folio);
> if (head) {
> diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
> index 4d5a6aa5214c..45fb37215669 100644
> --- a/fs/nilfs2/recovery.c
> +++ b/fs/nilfs2/recovery.c
> @@ -34,7 +34,7 @@ enum {
>
> /* work structure for recovery */
> struct nilfs_recovery_block {
> - ino_t ino; /*
> + u64 ino; /*
> * Inode number of the file that
> this block
> * belongs to
> */
> @@ -333,7 +333,7 @@ static int nilfs_scan_dsync_log(struct the_nilfs
> *nilfs, sector_t start_blocknr,
> unsigned int offset;
> u32 nfinfo, sumbytes;
> sector_t blocknr;
> - ino_t ino;
> + u64 ino;
> int err = -EIO;
>
> nfinfo = le32_to_cpu(sum->ss_nfinfo);
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index 5896fdae5669..829573cb6131 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -1610,7 +1610,7 @@ nilfs_segctor_update_payload_blocknr(struct
> nilfs_sc_info *sci,
> struct nilfs_finfo *finfo = NULL;
> union nilfs_binfo binfo;
> struct buffer_head *bh, *bh_org;
> - ino_t ino = 0;
> + u64 ino = 0;
> int err = 0;
>
> if (!nfinfo)
Applied.
Thanks,
Slava.