summaryrefslogtreecommitdiff
path: root/fs/hfs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2026-03-04 10:32:42 -0500
committerChristian Brauner <brauner@kernel.org>2026-03-06 14:31:28 +0100
commit0b2600f81cefcdfcda58d50df7be8fd48ada8ce2 (patch)
treec372fc873b29e01e4262c2cdc19bef7c85e0321c /fs/hfs
parentd84c70c6eab10e56d22c394e3a250c1c6fde8d6e (diff)
treewide: change inode->i_ino from unsigned long to u64
On 32-bit architectures, unsigned long is only 32 bits wide, which causes 64-bit inode numbers to be silently truncated. Several filesystems (NFS, XFS, BTRFS, etc.) can generate inode numbers that exceed 32 bits, and this truncation can lead to inode number collisions and other subtle bugs on 32-bit systems. Change the type of inode->i_ino from unsigned long to u64 to ensure that inode numbers are always represented as 64-bit values regardless of architecture. Update all format specifiers treewide from %lu/%lx to %llu/%llx to match the new type, along with corresponding local variable types. This is the bulk treewide conversion. Earlier patches in this series handled trace events separately to allow trace field reordering for better struct packing on 32-bit. Signed-off-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20260304-iino-u64-v3-12-2257ad83d372@kernel.org Acked-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/hfs')
-rw-r--r--fs/hfs/catalog.c2
-rw-r--r--fs/hfs/extent.c4
-rw-r--r--fs/hfs/inode.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index b80ba40e3877..7f5339ee57c1 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -417,7 +417,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,
int entry_size, type;
int err;
- hfs_dbg("cnid %u - (ino %lu, name %s) - (ino %lu, name %s)\n",
+ hfs_dbg("cnid %u - (ino %llu, name %s) - (ino %llu, name %s)\n",
cnid, src_dir->i_ino, src_name->name,
dst_dir->i_ino, dst_name->name);
sb = src_dir->i_sb;
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index a097908b269d..f066a99a863b 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -411,7 +411,7 @@ int hfs_extend_file(struct inode *inode)
goto out;
}
- hfs_dbg("ino %lu, start %u, len %u\n", inode->i_ino, start, len);
+ hfs_dbg("ino %llu, start %u, len %u\n", inode->i_ino, start, len);
if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks) {
if (!HFS_I(inode)->first_blocks) {
hfs_dbg("first_extent: start %u, len %u\n",
@@ -482,7 +482,7 @@ void hfs_file_truncate(struct inode *inode)
u32 size;
int res;
- hfs_dbg("ino %lu, phys_size %llu -> i_size %llu\n",
+ hfs_dbg("ino %llu, phys_size %llu -> i_size %llu\n",
inode->i_ino, (long long)HFS_I(inode)->phys_size,
inode->i_size);
if (inode->i_size > HFS_I(inode)->phys_size) {
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 878535db64d6..95f0333a608b 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -270,7 +270,7 @@ void hfs_delete_inode(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
- hfs_dbg("ino %lu\n", inode->i_ino);
+ hfs_dbg("ino %llu\n", inode->i_ino);
if (S_ISDIR(inode->i_mode)) {
atomic64_dec(&HFS_SB(sb)->folder_count);
if (HFS_I(inode)->cat_key.ParID == cpu_to_be32(HFS_ROOT_CNID))
@@ -455,7 +455,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)
hfs_cat_rec rec;
int res;
- hfs_dbg("ino %lu\n", inode->i_ino);
+ hfs_dbg("ino %llu\n", inode->i_ino);
res = hfs_ext_write_extent(inode);
if (res)
return res;