Thread (177 messages) 177 messages, 17 authors, 2026-03-04

Re: [PATCH v2 007/110] ext4: use PRIino format for i_ino

From: Jeff Layton <jlayton@kernel.org>
Date: 2026-03-03 11:42:09
Also in: amd-gfx, autofs, bpf, ceph-devel, dri-devel, linux-bluetooth, linux-can, linux-cifs, linux-ext4, linux-f2fs-devel, linux-fscrypt, linux-fsdevel, linux-hams, linux-integrity, linux-media, linux-mm, linux-nfs, linux-perf-users, linux-sctp, linux-security-module, linux-trace-kernel, linux-unionfs, linux-xfs, lkml, netfs, ntfs3, nvdimm, ocfs2-devel, selinux, v9fs

On Tue, 2026-03-03 at 12:20 +0100, Jan Kara wrote:
On Mon 02-03-26 15:23:51, Jeff Layton wrote:
quoted
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 <jlayton@kernel.org>
Two small comments. Otherwise feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>
quoted
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.
quoted
@@ -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 [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help