Re: [PATCH 17/61] nilfs2: update for u64 i_ino

Viacheslav Dubeyko
2026-02-26T19:47:10Z

On Thu, 2026-02-26 at 10:55 -0500, Jeff Layton wrote:
> Update nilfs2 trace events and filesystem code for u64 i_ino:
>
> - Change __field(ino_t, ...) to __field(u64, ...) in trace events
> - Update format strings from %lu to %llu
> - Cast to (unsigned long long) in TP_printk
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/nilfs2/alloc.c | 10 +++++-----
> fs/nilfs2/bmap.c | 2 +-
> fs/nilfs2/btnode.c | 2 +-
> fs/nilfs2/btree.c | 12 ++++++------
> fs/nilfs2/dir.c | 12 ++++++------
> fs/nilfs2/direct.c | 4 ++--
> fs/nilfs2/gcinode.c | 2 +-
> fs/nilfs2/inode.c | 8 ++++----
> fs/nilfs2/mdt.c | 2 +-
> fs/nilfs2/namei.c | 2 +-
> fs/nilfs2/segment.c | 2 +-
> include/trace/events/nilfs2.h | 12 ++++++------
> 12 files changed, 35 insertions(+), 35 deletions(-)
>
> diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c
> index e7eebb04f9a4080a39f17d4123e58ed7df6b2f4b..7b1cd2baefcf21e54f9260845b02c7c95c148c64 100644
> --- a/fs/nilfs2/alloc.c
> +++ b/fs/nilfs2/alloc.c
> @@ -707,7 +707,7 @@ void nilfs_palloc_commit_free_entry(struct inode *inode,
>
> if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
> nilfs_warn(inode->i_sb,
> - "%s (ino=%lu): entry number %llu already freed",
> + "%s (ino=%llu): entry number %llu already freed",
> __func__, inode->i_ino,
> (unsigned long long)req->pr_entry_nr);
> else
> @@ -748,7 +748,7 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode,
>
> if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
> nilfs_warn(inode->i_sb,
> - "%s (ino=%lu): entry number %llu already freed",
> + "%s (ino=%llu): entry number %llu already freed",
> __func__, inode->i_ino,
> (unsigned long long)req->pr_entry_nr);
> else
> @@ -861,7 +861,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
> if (!nilfs_clear_bit_atomic(lock, group_offset,
> bitmap)) {
> nilfs_warn(inode->i_sb,
> - "%s (ino=%lu): entry number %llu already freed",
> + "%s (ino=%llu): entry number %llu already freed",
> __func__, inode->i_ino,
> (unsigned long long)entry_nrs[j]);
> } else {
> @@ -906,7 +906,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
> last_nrs[k]);
> if (ret && ret != -ENOENT)
> nilfs_warn(inode->i_sb,
> - "error %d deleting block that object (entry=%llu, ino=%lu) belongs to",
> + "error %d deleting block that object (entry=%llu, ino=%llu) belongs to",
> ret, (unsigned long long)last_nrs[k],
> inode->i_ino);
> }
> @@ -923,7 +923,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
> ret = nilfs_palloc_delete_bitmap_block(inode, group);
> if (ret && ret != -ENOENT)
> nilfs_warn(inode->i_sb,
> - "error %d deleting bitmap block of group=%lu, ino=%lu",
> + "error %d deleting bitmap block of group=%lu, ino=%llu",
> ret, group, inode->i_ino);
> }
> }
> diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
> index ccc1a7aa52d2064d56b826058554264c498d592f..824f2bd91c167965ec3a660202b6e6c5f1fe007e 100644
> --- a/fs/nilfs2/bmap.c
> +++ b/fs/nilfs2/bmap.c
> @@ -33,7 +33,7 @@ static int nilfs_bmap_convert_error(struct nilfs_bmap *bmap,
>
> if (err == -EINVAL) {
> __nilfs_error(inode->i_sb, fname,
> - "broken bmap (inode number=%lu)", inode->i_ino);
> + "broken bmap (inode number=%llu)", inode->i_ino);
> err = -EIO;
> }
> return err;
> diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
> index 56836712909201775907483887e8a0022851bbec..2e553d698d0f3980de98fced415dfd819ddbca0a 100644
> --- a/fs/nilfs2/btnode.c
> +++ b/fs/nilfs2/btnode.c
> @@ -64,7 +64,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
> * clearing of an abandoned b-tree node is missing somewhere).
> */
> nilfs_error(inode->i_sb,
> - "state inconsistency probably due to duplicate use of b-tree node block address %llu (ino=%lu)",
> + "state inconsistency probably due to duplicate use of b-tree node block address %llu (ino=%llu)",
> (unsigned long long)blocknr, inode->i_ino);
> goto failed;
> }
> diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
> index dd0c8e560ef6a2c96515025321914e0d73f41144..3c03f5a741d144d22d1ffb5acf43a035e88c00dc 100644
> --- a/fs/nilfs2/btree.c
> +++ b/fs/nilfs2/btree.c
> @@ -353,7 +353,7 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
> nchildren <= 0 ||
> nchildren > NILFS_BTREE_NODE_NCHILDREN_MAX(size))) {
> nilfs_crit(inode->i_sb,
> - "bad btree node (ino=%lu, blocknr=%llu): level = %d, flags = 0x%x, nchildren = %d",
> + "bad btree node (ino=%llu, blocknr=%llu): level = %d, flags = 0x%x, nchildren = %d",
> inode->i_ino, (unsigned long long)blocknr, level,
> flags, nchildren);
> ret = 1;
> @@ -384,7 +384,7 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
> nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX ||
> (nchildren == 0 && level > NILFS_BTREE_LEVEL_NODE_MIN))) {
> nilfs_crit(inode->i_sb,
> - "bad btree root (ino=%lu): level = %d, flags = 0x%x, nchildren = %d",
> + "bad btree root (ino=%llu): level = %d, flags = 0x%x, nchildren = %d",
> inode->i_ino, level, flags, nchildren);
> ret = 1;
> }
> @@ -453,7 +453,7 @@ static int nilfs_btree_bad_node(const struct nilfs_bmap *btree,
> if (unlikely(nilfs_btree_node_get_level(node) != level)) {
> dump_stack();
> nilfs_crit(btree->b_inode->i_sb,
> - "btree level mismatch (ino=%lu): %d != %d",
> + "btree level mismatch (ino=%llu): %d != %d",
> btree->b_inode->i_ino,
> nilfs_btree_node_get_level(node), level);
> return 1;
> @@ -521,7 +521,7 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr,
> out_no_wait:
> if (!buffer_uptodate(bh)) {
> nilfs_err(btree->b_inode->i_sb,
> - "I/O error reading b-tree node block (ino=%lu, blocknr=%llu)",
> + "I/O error reading b-tree node block (ino=%llu, blocknr=%llu)",
> btree->b_inode->i_ino, (unsigned long long)ptr);
> brelse(bh);
> return -EIO;
> @@ -2104,7 +2104,7 @@ static int nilfs_btree_propagate(struct nilfs_bmap *btree,
> if (ret < 0) {
> if (unlikely(ret == -ENOENT)) {
> nilfs_crit(btree->b_inode->i_sb,
> - "writing node/leaf block does not appear in b-tree (ino=%lu) at key=%llu, level=%d",
> + "writing node/leaf block does not appear in b-tree (ino=%llu) at key=%llu, level=%d",
> btree->b_inode->i_ino,
> (unsigned long long)key, level);
> ret = -EINVAL;
> @@ -2146,7 +2146,7 @@ static void nilfs_btree_add_dirty_buffer(struct nilfs_bmap *btree,
> level >= NILFS_BTREE_LEVEL_MAX) {
> dump_stack();
> nilfs_warn(btree->b_inode->i_sb,
> - "invalid btree level: %d (key=%llu, ino=%lu, blocknr=%llu)",
> + "invalid btree level: %d (key=%llu, ino=%llu, blocknr=%llu)",
> level, (unsigned long long)key,
> btree->b_inode->i_ino,
> (unsigned long long)bh->b_blocknr);
> diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
> index b243199036dfa1ab2299efaaa5bdf5da2d159ff2..3653db5cdb65137d1e660bb509c14ec4cbc8840b 100644
> --- a/fs/nilfs2/dir.c
> +++ b/fs/nilfs2/dir.c
> @@ -150,7 +150,7 @@ static bool nilfs_check_folio(struct folio *folio, char *kaddr)
>
> Ebadsize:
> nilfs_error(sb,
> - "size of directory #%lu is not a multiple of chunk size",
> + "size of directory #%llu is not a multiple of chunk size",
> dir->i_ino);
> goto fail;
> Eshort:
> @@ -169,7 +169,7 @@ static bool nilfs_check_folio(struct folio *folio, char *kaddr)
> error = "disallowed inode number";
> bad_entry:
> nilfs_error(sb,
> - "bad entry in directory #%lu: %s - offset=%lu, inode=%lu, rec_len=%zd, name_len=%d",
> + "bad entry in directory #%llu: %s - offset=%lu, inode=%lu, rec_len=%zd, name_len=%d",

I think you missed 'inode=%lu' here.

> dir->i_ino, error, (folio->index << PAGE_SHIFT) + offs,
> (unsigned long)le64_to_cpu(p->inode),
> rec_len, p->name_len);
> @@ -177,7 +177,7 @@ static bool nilfs_check_folio(struct folio *folio, char *kaddr)
> Eend:
> p = (struct nilfs_dir_entry *)(kaddr + offs);
> nilfs_error(sb,
> - "entry in directory #%lu spans the page boundary offset=%lu, inode=%lu",
> + "entry in directory #%llu spans the page boundary offset=%lu, inode=%lu",

Ditto. You missed 'inode=%lu' here.

Thanks,
Slava.

> dir->i_ino, (folio->index << PAGE_SHIFT) + offs,
> (unsigned long)le64_to_cpu(p->inode));
> fail:
> @@ -251,7 +251,7 @@ static int nilfs_readdir(struct file *file, struct dir_context *ctx)
>
> kaddr = nilfs_get_folio(inode, n, &folio);
> if (IS_ERR(kaddr)) {
> - nilfs_error(sb, "bad page in #%lu", inode->i_ino);
> + nilfs_error(sb, "bad page in #%llu", inode->i_ino);
> ctx->pos += PAGE_SIZE - offset;
> return -EIO;
> }
> @@ -336,7 +336,7 @@ struct nilfs_dir_entry *nilfs_find_entry(struct inode *dir,
> /* next folio is past the blocks we've got */
> if (unlikely(n > (dir->i_blocks >> (PAGE_SHIFT - 9)))) {
> nilfs_error(dir->i_sb,
> - "dir %lu size %lld exceeds block count %llu",
> + "dir %llu size %lld exceeds block count %llu",
> dir->i_ino, dir->i_size,
> (unsigned long long)dir->i_blocks);
> goto out;
> @@ -382,7 +382,7 @@ struct nilfs_dir_entry *nilfs_dotdot(struct inode *dir, struct folio **foliop)
> return next_de;
>
> fail:
> - nilfs_error(dir->i_sb, "directory #%lu %s", dir->i_ino, msg);
> + nilfs_error(dir->i_sb, "directory #%llu %s", dir->i_ino, msg);
> folio_release_kmap(folio, de);
> return NULL;
> }
> diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c
> index 2d8dc6b35b5477947ca12a70288d3a3cce858aab..8bd0b1374e25f8ff510f3b36dbde2acc01aafc1e 100644
> --- a/fs/nilfs2/direct.c
> +++ b/fs/nilfs2/direct.c
> @@ -338,7 +338,7 @@ static int nilfs_direct_assign(struct nilfs_bmap *bmap,
> key = nilfs_bmap_data_get_key(bmap, *bh);
> if (unlikely(key > NILFS_DIRECT_KEY_MAX)) {
> nilfs_crit(bmap->b_inode->i_sb,
> - "%s (ino=%lu): invalid key: %llu",
> + "%s (ino=%llu): invalid key: %llu",
> __func__,
> bmap->b_inode->i_ino, (unsigned long long)key);
> return -EINVAL;
> @@ -346,7 +346,7 @@ static int nilfs_direct_assign(struct nilfs_bmap *bmap,
> ptr = nilfs_direct_get_ptr(bmap, key);
> if (unlikely(ptr == NILFS_BMAP_INVALID_PTR)) {
> nilfs_crit(bmap->b_inode->i_sb,
> - "%s (ino=%lu): invalid pointer: %llu",
> + "%s (ino=%llu): invalid pointer: %llu",
> __func__,
> bmap->b_inode->i_ino, (unsigned long long)ptr);
> return -EINVAL;
> diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
> index 561c220799c7aee879ad866865e377799c8ee6bb..62d4c1b787e95c961a360a4214d621d564ad8b4c 100644
> --- a/fs/nilfs2/gcinode.c
> +++ b/fs/nilfs2/gcinode.c
> @@ -137,7 +137,7 @@ int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh)
> struct inode *inode = bh->b_folio->mapping->host;
>
> nilfs_err(inode->i_sb,
> - "I/O error reading %s block for GC (ino=%lu, vblocknr=%llu)",
> + "I/O error reading %s block for GC (ino=%llu, vblocknr=%llu)",
> buffer_nilfs_node(bh) ? "node" : "data",
> inode->i_ino, (unsigned long long)bh->b_blocknr);
> return -EIO;
> diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
> index 51bde45d586509dda3ef0cb7c46facb7fb2c61dd..51f7e125a311b868860e3e111700d49d4cb98fa6 100644
> --- a/fs/nilfs2/inode.c
> +++ b/fs/nilfs2/inode.c
> @@ -108,7 +108,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
> * be locked in this case.
> */
> nilfs_warn(inode->i_sb,
> - "%s (ino=%lu): a race condition while inserting a data block at offset=%llu",
> + "%s (ino=%llu): a race condition while inserting a data block at offset=%llu",
> __func__, inode->i_ino,
> (unsigned long long)blkoff);
> err = -EAGAIN;
> @@ -789,7 +789,7 @@ static void nilfs_truncate_bmap(struct nilfs_inode_info *ii,
> goto repeat;
>
> failed:
> - nilfs_warn(ii->vfs_inode.i_sb, "error %d truncating bmap (ino=%lu)",
> + nilfs_warn(ii->vfs_inode.i_sb, "error %d truncating bmap (ino=%llu)",
> ret, ii->vfs_inode.i_ino);
> }
>
> @@ -1026,7 +1026,7 @@ int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)
> * this inode.
> */
> nilfs_warn(inode->i_sb,
> - "cannot set file dirty (ino=%lu): the file is being freed",
> + "cannot set file dirty (ino=%llu): the file is being freed",
> inode->i_ino);
> spin_unlock(&nilfs->ns_inode_lock);
> return -EINVAL; /*
> @@ -1057,7 +1057,7 @@ int __nilfs_mark_inode_dirty(struct inode *inode, int flags)
> err = nilfs_load_inode_block(inode, &ibh);
> if (unlikely(err)) {
> nilfs_warn(inode->i_sb,
> - "cannot mark inode dirty (ino=%lu): error %d loading inode block",
> + "cannot mark inode dirty (ino=%llu): error %d loading inode block",
> inode->i_ino, err);
> return err;
> }
> diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
> index 946b0d3534a5f22f34ac44a91fb121541881c548..09adb40c65e505d92012a3d2f5fe8a5696e10056 100644
> --- a/fs/nilfs2/mdt.c
> +++ b/fs/nilfs2/mdt.c
> @@ -203,7 +203,7 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
> err = -EIO;
> if (!buffer_uptodate(first_bh)) {
> nilfs_err(inode->i_sb,
> - "I/O error reading meta-data file (ino=%lu, block-offset=%lu)",
> + "I/O error reading meta-data file (ino=%llu, block-offset=%lu)",
> inode->i_ino, block);
> goto failed_bh;
> }
> diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
> index 40f4b1a28705b6e0eb8f0978cf3ac18b43aa1331..40ac679ec56e400b1df98e9be6fe9ca338a9ba51 100644
> --- a/fs/nilfs2/namei.c
> +++ b/fs/nilfs2/namei.c
> @@ -292,7 +292,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
>
> if (!inode->i_nlink) {
> nilfs_warn(inode->i_sb,
> - "deleting nonexistent file (ino=%lu), %d",
> + "deleting nonexistent file (ino=%llu), %d",
> inode->i_ino, inode->i_nlink);
> set_nlink(inode, 1);
> }
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index 098a3bd103e04cd09b0689fe2017380d74664496..4b1bf559f3524b1cc3965dae9fd3e5745718569d 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -2024,7 +2024,7 @@ static int nilfs_segctor_collect_dirty_files(struct nilfs_sc_info *sci,
> ifile, ii->vfs_inode.i_ino, &ibh);
> if (unlikely(err)) {
> nilfs_warn(sci->sc_super,
> - "log writer: error %d getting inode block (ino=%lu)",
> + "log writer: error %d getting inode block (ino=%llu)",
> err, ii->vfs_inode.i_ino);
> return err;
> }
> diff --git a/include/trace/events/nilfs2.h b/include/trace/events/nilfs2.h
> index 8880c11733dd307c223cc62ee34ebeff650ecb12..86a0011c9eeaf031cfa0b79875b2b106ef8b7cfd 100644
> --- a/include/trace/events/nilfs2.h
> +++ b/include/trace/events/nilfs2.h
> @@ -165,14 +165,14 @@ TRACE_EVENT(nilfs2_segment_usage_freed,
>
> TRACE_EVENT(nilfs2_mdt_insert_new_block,
> TP_PROTO(struct inode *inode,
> - unsigned long ino,
> + u64 ino,
> unsigned long block),
>
> TP_ARGS(inode, ino, block),
>
> TP_STRUCT__entry(
> __field(struct inode *, inode)
> - __field(unsigned long, ino)
> + __field(u64, ino)
> __field(unsigned long, block)
> ),
>
> @@ -182,7 +182,7 @@ TRACE_EVENT(nilfs2_mdt_insert_new_block,
> __entry->block = block;
> ),
>
> - TP_printk("inode = %p ino = %lu block = %lu",
> + TP_printk("inode = %p ino = %llu block = %lu",
> __entry->inode,
> __entry->ino,
> __entry->block)
> @@ -190,7 +190,7 @@ TRACE_EVENT(nilfs2_mdt_insert_new_block,
>
> TRACE_EVENT(nilfs2_mdt_submit_block,
> TP_PROTO(struct inode *inode,
> - unsigned long ino,
> + u64 ino,
> unsigned long blkoff,
> enum req_op mode),
>
> @@ -198,7 +198,7 @@ TRACE_EVENT(nilfs2_mdt_submit_block,
>
> TP_STRUCT__entry(
> __field(struct inode *, inode)
> - __field(unsigned long, ino)
> + __field(u64, ino)
> __field(unsigned long, blkoff)
> /*
> * Use field_struct() to avoid is_signed_type() on the
> @@ -214,7 +214,7 @@ TRACE_EVENT(nilfs2_mdt_submit_block,
> __entry->mode = mode;
> ),
>
> - TP_printk("inode = %p ino = %lu blkoff = %lu mode = %x",
> + TP_printk("inode = %p ino = %llu blkoff = %lu mode = %x",
> __entry->inode,
> __entry->ino,
> __entry->blkoff,