Re: [PATCH v2 007/110] ext4: use PRIino format for i_ino
On Tue, 2026-03-03 at 12:20 +0100, Jan Kara wrote:
> On Mon 02-03-26 15:23:51, Jeff Layton wrote:
> > Convert ext4 i_ino format strings to use the PRIino format
> > macro in preparation for the widening of i_ino via kino_t.
> >
> > In trace events, change __field(ino_t, ...) to __field(u64, ...)
> > and update TP_printk format strings to %llu/%llx to match the
> > widened field type.
> >
> > Update local variables and function parameters that hold i_ino
> > values from unsigned long to kino_t.
> >
> > Signed-off-by: Jeff Layton
>
> Two small comments. Otherwise feel free to add:
>
> Reviewed-by: Jan Kara
>
> > diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
> > index
> > 96ab95167bd6e10ba86e61a60cb0be9fbafe157f..43103816b80ef4901858bcd789acb0ffb2612317
> > 100644
> > --- a/fs/ext4/migrate.c
> > +++ b/fs/ext4/migrate.c
> > @@ -455,7 +455,7 @@ int ext4_ext_migrate(struct inode *inode)
> > * log, so disable fast commits for this transaction.
> > */
> > ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_MIGRATE, handle);
> > - goal = (((inode->i_ino - 1) / EXT4_INODES_PER_GROUP(inode->i_sb)) *
> > + goal = (div_u64(inode->i_ino - 1, EXT4_INODES_PER_GROUP(inode->i_sb)) *
>
> Ext4 doesn't support more than 2^32 inodes (due to on-disk format). Thus
> i_ino is always guaranteed to be a number that fits in 32-bits. Thus I'd
> here just type i_ino to (unsigned int) and be done with it like you've done
> it at other places.
>
> ...
>
Thanks. Fixed both places. I ended up casting the above to a u32 since
this patchset has given me a stronger affinity for explicit-width
types.
> > @@ -1823,7 +1823,7 @@ TRACE_EVENT(ext4_journal_start_inode,
> > TP_ARGS(inode, blocks, rsv_blocks, revoke_creds, type, IP),
> >
> > TP_STRUCT__entry(
> > - __field(unsigned long, ino )
> > + __field(u64,ino )
> > __field(dev_t, dev )
> > __field(unsigned long, ip )
> > __field(int,blocks )
> > @@ -1843,9 +1843,10 @@ TRACE_EVENT(ext4_journal_start_inode,
> > ),
> >
> > TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
> > - " type %d, ino %lu, caller %pS", MAJOR(__entry->dev),
> > + " type %d, ino %llu, caller %pS", MAJOR(__entry->dev),
> > MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
> > - __entry->revoke_creds, __entry->type, __entry->ino,
> > + __entry->revoke_creds, __entry->type,
> > + (unsigned long long) __entry->ino,
>
> Not point in the type cast?
>
> Honza
--
Jeff Layton
Re: [PATCH v2 007/110] ext4: use PRIino format for i_ino
On Mon 02-03-26 15:23:51, Jeff Layton wrote:
> Convert ext4 i_ino format strings to use the PRIino format
> macro in preparation for the widening of i_ino via kino_t.
>
> In trace events, change __field(ino_t, ...) to __field(u64, ...)
> and update TP_printk format strings to %llu/%llx to match the
> widened field type.
>
> Update local variables and function parameters that hold i_ino
> values from unsigned long to kino_t.
>
> Signed-off-by: Jeff Layton
Two small comments. Otherwise feel free to add:
Reviewed-by: Jan Kara
> diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
> index
> 96ab95167bd6e10ba86e61a60cb0be9fbafe157f..43103816b80ef4901858bcd789acb0ffb2612317
> 100644
> --- a/fs/ext4/migrate.c
> +++ b/fs/ext4/migrate.c
> @@ -455,7 +455,7 @@ int ext4_ext_migrate(struct inode *inode)
>* log, so disable fast commits for this transaction.
>*/
> ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_MIGRATE, handle);
> - goal = (((inode->i_ino - 1) / EXT4_INODES_PER_GROUP(inode->i_sb)) *
> + goal = (div_u64(inode->i_ino - 1, EXT4_INODES_PER_GROUP(inode->i_sb)) *
Ext4 doesn't support more than 2^32 inodes (due to on-disk format). Thus
i_ino is always guaranteed to be a number that fits in 32-bits. Thus I'd
here just type i_ino to (unsigned int) and be done with it like you've done
it at other places.
...
> @@ -1823,7 +1823,7 @@ TRACE_EVENT(ext4_journal_start_inode,
> TP_ARGS(inode, blocks, rsv_blocks, revoke_creds, type, IP),
>
> TP_STRUCT__entry(
> - __field(unsigned long, ino )
> + __field(u64,ino )
> __field(dev_t, dev )
> __field(unsigned long, ip )
> __field(int,blocks )
> @@ -1843,9 +1843,10 @@ TRACE_EVENT(ext4_journal_start_inode,
> ),
>
> TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
> - " type %d, ino %lu, caller %pS", MAJOR(__entry->dev),
> + " type %d, ino %llu, caller %pS", MAJOR(__entry->dev),
> MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
> - __entry->revoke_creds, __entry->type, __entry->ino,
> + __entry->revoke_creds, __entry->type,
> + (unsigned long long) __entry->ino,
Not point in the type cast?
Honza
--
Jan Kara
SUSE Labs, CR
[PATCH v2 007/110] ext4: use PRIino format for i_ino
Convert ext4 i_ino format strings to use the PRIino format
macro in preparation for the widening of i_ino via kino_t.
In trace events, change __field(ino_t, ...) to __field(u64, ...)
and update TP_printk format strings to %llu/%llx to match the
widened field type.
Update local variables and function parameters that hold i_ino
values from unsigned long to kino_t.
Signed-off-by: Jeff Layton
---
fs/ext4/dir.c | 2 +-
fs/ext4/ext4.h | 4 +-
fs/ext4/extents.c | 8 +-
fs/ext4/extents_status.c| 28 +--
fs/ext4/fast_commit.c | 8 +-
fs/ext4/ialloc.c| 10 +-
fs/ext4/indirect.c | 2 +-
fs/ext4/inline.c| 14 +-
fs/ext4/inode.c | 22 +--
fs/ext4/ioctl.c | 4 +-
fs/ext4/mballoc.c | 6 +-
fs/ext4/migrate.c | 2 +-
fs/ext4/move_extent.c | 20 +--
fs/ext4/namei.c | 10 +-
fs/ext4/orphan.c| 16 +-
fs/ext4/page-io.c | 10 +-
fs/ext4/super.c | 22 +--
fs/ext4/xattr.c | 10 +-
include/trace/events/ext4.h | 423 ++--
19 files changed, 311 insertions(+), 310 deletions(-)
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index
28b2a3deb954fe275cd2f7290f2daeafa2d3dbed..785d482b0ff01686ed420508e826eb8d2745aa92
100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -535,7 +535,7 @@ static int call_filldir(struct file *file, struct
dir_context *ctx,
struct super_block *sb = inode->i_sb;
if (!fname) {
- ext4_msg(sb, KERN_ERR, "%s:%d: inode #%lu: comm %s: "
+ ext4_msg(sb, KERN_ERR, "%s:%d: inode #%" PRIino "u: comm %s: "
"called with null fname?!?", __func__, __LINE__,
inode->i_ino, current->comm);
return 0;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index
293f698b7042438b2757790717db22bca060797d..d2bf5f7db5524c50626833a82987f89965ab7f67
100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -92,7 +92,7 @@
*/
#ifdef CONFIG_EXT4_DEBUG
#define ext_debug(ino, fmt, ...) \
- pr_debug("[%s/%d] EXT4-fs (%s): ino %lu: (%s, %d): %s:" fmt,\
+ pr_debug("[%s/%d] EXT4-fs (%s): ino %" PRIino "u: (%s, %d): %s:" fmt,
\
current->comm, task_pid_nr(current), \
ino->i_sb->s_id, ino->i_ino, __FILE__, __LINE__, \
__func__, ##__VA_ARGS__)
@@ -3229,7 +3229,7 @@ extern void __dump_mmp_msg(struct super_block *, struct
mmp_struct *mmp,
extern __printf(7, 8)
void __ext4_grp_locked_error(const char *, unsigned int,
struct super_block *, ext4_group_t,
-unsigned long, ext4_fsblk_t,
+kino_t, ext4_fsblk_t,
const char *, ...);
#define EXT4_ERROR_INODE(inode, fmt, a...) \
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index
ae3804f36535aeca4009bfae992e1f2f665aded2..668bb30771fb4fb33e75971b4488359e636d7d1b
100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4603,7 +4603,7 @@ static int ext4_alloc_file_blocks(struct file *file,
ext4_lblk_t offset,
}
ret = ext4_map_blocks(handle, inode, &map, flags);
if (ret <= 0) {
- ext4_debug("inode #%lu: block %u: len %u: "
+ ext4_debug("inode #%" PRIino "u: block %u: len %u: "
"ext4_ext_map_blocks returned %d",
inode->i_ino, map.m_lblk,
map.m_len, ret);
@@ -4955,7 +4955,7 @@ int ext4_convert_unwritten_extents_atomic(handle_t
*handle, struct inode *inode,
ret = ext4_map_blocks(handle, inode, &map, flags);
if (ret != max_blocks)
ext4_msg(inode->i_sb, KERN_INFO,
-"inode #%lu: block %u: len %u: "
+"inode #%" PRIino "u: block %u: len %u: "
"split block mapping found for atomic
write, "
"ret = %d",
inode->i_ino, map.m_lblk,
@@ -4974,7 +4974,7 @@ int ext4_convert_unwritten_extents_atomic(handle_t
*handle, struct inode *inode,
if (ret <= 0 || ret2)
ext4_warning(inode->i_sb,
-"inode #%lu: block %u: len %u: "
+"inode #%" PRIino "u: block %u: len %u: "
"returned %d or %d",
inode->i_ino, map.m_lblk,
map.m_len, ret, ret2);
@@ -5031,7 +5031,7 @@ int ext4_convert_unwritten_extents(handle_t *handle,
struct inode *inode,
EXT4_EX_NOCACHE);
if (ret <= 0)
ex
