diff options
| author | Jeff Layton <jlayton@kernel.org> | 2026-03-04 10:32:42 -0500 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-03-06 14:31:28 +0100 |
| commit | 0b2600f81cefcdfcda58d50df7be8fd48ada8ce2 (patch) | |
| tree | c372fc873b29e01e4262c2cdc19bef7c85e0321c /fs/affs | |
| parent | d84c70c6eab10e56d22c394e3a250c1c6fde8d6e (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/affs')
| -rw-r--r-- | fs/affs/amigaffs.c | 10 | ||||
| -rw-r--r-- | fs/affs/bitmap.c | 2 | ||||
| -rw-r--r-- | fs/affs/dir.c | 2 | ||||
| -rw-r--r-- | fs/affs/file.c | 20 | ||||
| -rw-r--r-- | fs/affs/inode.c | 12 | ||||
| -rw-r--r-- | fs/affs/namei.c | 14 | ||||
| -rw-r--r-- | fs/affs/symlink.c | 2 |
7 files changed, 31 insertions, 31 deletions
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index fd669daa4e7b..d8a96d8cc826 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -33,7 +33,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh) ino = bh->b_blocknr; offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]); - pr_debug("%s(dir=%lu, ino=%d)\n", __func__, dir->i_ino, ino); + pr_debug("%s(dir=%llu, ino=%d)\n", __func__, dir->i_ino, ino); dir_bh = affs_bread(sb, dir->i_ino); if (!dir_bh) @@ -83,7 +83,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh) sb = dir->i_sb; rem_ino = rem_bh->b_blocknr; offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]); - pr_debug("%s(dir=%lu, ino=%d, hashval=%d)\n", __func__, dir->i_ino, + pr_debug("%s(dir=%llu, ino=%d, hashval=%d)\n", __func__, dir->i_ino, rem_ino, offset); bh = affs_bread(sb, dir->i_ino); @@ -128,7 +128,7 @@ affs_fix_dcache(struct inode *inode, u32 entry_ino) spin_lock(&inode->i_lock); hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { if (entry_ino == (u32)(long)dentry->d_fsdata) { - dentry->d_fsdata = (void *)inode->i_ino; + dentry->d_fsdata = (void *)(unsigned long)inode->i_ino; break; } } @@ -147,7 +147,7 @@ affs_remove_link(struct dentry *dentry) u32 link_ino, ino; int retval; - pr_debug("%s(key=%ld)\n", __func__, inode->i_ino); + pr_debug("%s(key=%llu)\n", __func__, inode->i_ino); retval = -EIO; bh = affs_bread(sb, inode->i_ino); if (!bh) @@ -279,7 +279,7 @@ affs_remove_header(struct dentry *dentry) if (!inode) goto done; - pr_debug("%s(key=%ld)\n", __func__, inode->i_ino); + pr_debug("%s(key=%llu)\n", __func__, inode->i_ino); retval = -EIO; bh = affs_bread(sb, (u32)(long)dentry->d_fsdata); if (!bh) diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c index 5ba9ef2742f6..40bc4ce6af4a 100644 --- a/fs/affs/bitmap.c +++ b/fs/affs/bitmap.c @@ -125,7 +125,7 @@ affs_alloc_block(struct inode *inode, u32 goal) sb = inode->i_sb; sbi = AFFS_SB(sb); - pr_debug("balloc(inode=%lu,goal=%u): ", inode->i_ino, goal); + pr_debug("balloc(inode=%llu,goal=%u): ", inode->i_ino, goal); if (AFFS_I(inode)->i_pa_cnt) { pr_debug("%d\n", AFFS_I(inode)->i_lastalloc+1); diff --git a/fs/affs/dir.c b/fs/affs/dir.c index 5c8d83387a39..11e2bac2e391 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c @@ -90,7 +90,7 @@ affs_readdir(struct file *file, struct dir_context *ctx) u32 ino; int error = 0; - pr_debug("%s(ino=%lu,f_pos=%llx)\n", __func__, inode->i_ino, ctx->pos); + pr_debug("%s(ino=%llu,f_pos=%llx)\n", __func__, inode->i_ino, ctx->pos); if (ctx->pos < 2) { data->ino = 0; diff --git a/fs/affs/file.c b/fs/affs/file.c index 6c9258359ddb..a51dee9d7d7e 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -24,7 +24,7 @@ static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext); static int affs_file_open(struct inode *inode, struct file *filp) { - pr_debug("open(%lu,%d)\n", + pr_debug("open(%llu,%d)\n", inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); atomic_inc(&AFFS_I(inode)->i_opencnt); return 0; @@ -33,7 +33,7 @@ affs_file_open(struct inode *inode, struct file *filp) static int affs_file_release(struct inode *inode, struct file *filp) { - pr_debug("release(%lu, %d)\n", + pr_debug("release(%llu, %d)\n", inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); if (atomic_dec_and_test(&AFFS_I(inode)->i_opencnt)) { @@ -301,7 +301,7 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul struct buffer_head *ext_bh; u32 ext; - pr_debug("%s(%lu, %llu)\n", __func__, inode->i_ino, + pr_debug("%s(%llu, %llu)\n", __func__, inode->i_ino, (unsigned long long)block); BUG_ON(block > (sector_t)0x7fffffffUL); @@ -534,7 +534,7 @@ static int affs_do_read_folio_ofs(struct folio *folio, size_t to, int create) size_t bidx, boff, bsize; u32 tmp; - pr_debug("%s(%lu, %ld, 0, %zu)\n", __func__, inode->i_ino, + pr_debug("%s(%llu, %ld, 0, %zu)\n", __func__, inode->i_ino, folio->index, to); BUG_ON(to > folio_size(folio)); bsize = AFFS_SB(sb)->s_data_blksize; @@ -566,7 +566,7 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize) u32 size, bsize; u32 tmp; - pr_debug("%s(%lu, %d)\n", __func__, inode->i_ino, newsize); + pr_debug("%s(%llu, %d)\n", __func__, inode->i_ino, newsize); bsize = AFFS_SB(sb)->s_data_blksize; bh = NULL; size = AFFS_I(inode)->mmu_private; @@ -634,7 +634,7 @@ static int affs_read_folio_ofs(struct file *file, struct folio *folio) size_t to; int err; - pr_debug("%s(%lu, %ld)\n", __func__, inode->i_ino, folio->index); + pr_debug("%s(%llu, %ld)\n", __func__, inode->i_ino, folio->index); to = folio_size(folio); if (folio_pos(folio) + to > inode->i_size) { to = inode->i_size - folio_pos(folio); @@ -658,7 +658,7 @@ static int affs_write_begin_ofs(const struct kiocb *iocb, pgoff_t index; int err = 0; - pr_debug("%s(%lu, %llu, %llu)\n", __func__, inode->i_ino, pos, + pr_debug("%s(%llu, %llu, %llu)\n", __func__, inode->i_ino, pos, pos + len); if (pos > AFFS_I(inode)->mmu_private) { /* XXX: this probably leaves a too-big i_size in case of @@ -710,7 +710,7 @@ static int affs_write_end_ofs(const struct kiocb *iocb, * due to write_begin. */ - pr_debug("%s(%lu, %llu, %llu)\n", __func__, inode->i_ino, pos, + pr_debug("%s(%llu, %llu, %llu)\n", __func__, inode->i_ino, pos, pos + len); bsize = AFFS_SB(sb)->s_data_blksize; data = folio_address(folio); @@ -854,7 +854,7 @@ affs_free_prealloc(struct inode *inode) { struct super_block *sb = inode->i_sb; - pr_debug("free_prealloc(ino=%lu)\n", inode->i_ino); + pr_debug("free_prealloc(ino=%llu)\n", inode->i_ino); while (AFFS_I(inode)->i_pa_cnt) { AFFS_I(inode)->i_pa_cnt--; @@ -874,7 +874,7 @@ affs_truncate(struct inode *inode) struct buffer_head *ext_bh; int i; - pr_debug("truncate(inode=%lu, oldsize=%llu, newsize=%llu)\n", + pr_debug("truncate(inode=%llu, oldsize=%llu, newsize=%llu)\n", inode->i_ino, AFFS_I(inode)->mmu_private, inode->i_size); last_blk = 0; diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 0bfc7d151dcd..561fc0185e89 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -32,7 +32,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) if (!(inode_state_read_once(inode) & I_NEW)) return inode; - pr_debug("affs_iget(%lu)\n", inode->i_ino); + pr_debug("affs_iget(%llu)\n", inode->i_ino); block = inode->i_ino; bh = affs_bread(sb, block); @@ -171,14 +171,14 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc) uid_t uid; gid_t gid; - pr_debug("write_inode(%lu)\n", inode->i_ino); + pr_debug("write_inode(%llu)\n", inode->i_ino); if (!inode->i_nlink) // possibly free block return 0; bh = affs_bread(sb, inode->i_ino); if (!bh) { - affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino); + affs_error(sb, "write_inode", "Cannot read block %llu", inode->i_ino); return -EIO; } tail = AFFS_TAIL(sb, bh); @@ -219,7 +219,7 @@ affs_notify_change(struct mnt_idmap *idmap, struct dentry *dentry, struct inode *inode = d_inode(dentry); int error; - pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid); + pr_debug("notify_change(%llu,0x%x)\n", inode->i_ino, attr->ia_valid); error = setattr_prepare(&nop_mnt_idmap, dentry, attr); if (error) @@ -260,7 +260,7 @@ void affs_evict_inode(struct inode *inode) { unsigned long cache_page; - pr_debug("evict_inode(ino=%lu, nlink=%u)\n", + pr_debug("evict_inode(ino=%llu, nlink=%u)\n", inode->i_ino, inode->i_nlink); truncate_inode_pages_final(&inode->i_data); @@ -353,7 +353,7 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3 u32 block = 0; int retval; - pr_debug("%s(dir=%lu, inode=%lu, \"%pd\", type=%d)\n", __func__, + pr_debug("%s(dir=%llu, inode=%llu, \"%pd\", type=%d)\n", __func__, dir->i_ino, inode->i_ino, dentry, type); retval = -EIO; diff --git a/fs/affs/namei.c b/fs/affs/namei.c index f883be50db12..870532192600 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -235,7 +235,7 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) int affs_unlink(struct inode *dir, struct dentry *dentry) { - pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, + pr_debug("%s(dir=%llu, %llu \"%pd\")\n", __func__, dir->i_ino, d_inode(dentry)->i_ino, dentry); return affs_remove_header(dentry); @@ -249,7 +249,7 @@ affs_create(struct mnt_idmap *idmap, struct inode *dir, struct inode *inode; int error; - pr_debug("%s(%lu,\"%pd\",0%ho)\n", + pr_debug("%s(%llu,\"%pd\",0%ho)\n", __func__, dir->i_ino, dentry, mode); inode = affs_new_inode(dir); @@ -280,7 +280,7 @@ affs_mkdir(struct mnt_idmap *idmap, struct inode *dir, struct inode *inode; int error; - pr_debug("%s(%lu,\"%pd\",0%ho)\n", + pr_debug("%s(%llu,\"%pd\",0%ho)\n", __func__, dir->i_ino, dentry, mode); inode = affs_new_inode(dir); @@ -306,7 +306,7 @@ affs_mkdir(struct mnt_idmap *idmap, struct inode *dir, int affs_rmdir(struct inode *dir, struct dentry *dentry) { - pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, + pr_debug("%s(dir=%llu, %llu \"%pd\")\n", __func__, dir->i_ino, d_inode(dentry)->i_ino, dentry); return affs_remove_header(dentry); @@ -323,7 +323,7 @@ affs_symlink(struct mnt_idmap *idmap, struct inode *dir, int i, maxlen, error; char c, lc; - pr_debug("%s(%lu,\"%pd\" -> \"%s\")\n", + pr_debug("%s(%llu,\"%pd\" -> \"%s\")\n", __func__, dir->i_ino, dentry, symname); maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1; @@ -395,7 +395,7 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { struct inode *inode = d_inode(old_dentry); - pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino, + pr_debug("%s(%llu, %llu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino, dentry); return affs_add_entry(dir, inode, dentry, ST_LINKFILE); @@ -511,7 +511,7 @@ int affs_rename2(struct mnt_idmap *idmap, struct inode *old_dir, if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) return -EINVAL; - pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, + pr_debug("%s(old=%llu,\"%pd\" to new=%llu,\"%pd\")\n", __func__, old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); if (flags & RENAME_EXCHANGE) diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c index 094aec8d17b8..de31ed2e71df 100644 --- a/fs/affs/symlink.c +++ b/fs/affs/symlink.c @@ -21,7 +21,7 @@ static int affs_symlink_read_folio(struct file *file, struct folio *folio) char c; char lc; - pr_debug("get_link(ino=%lu)\n", inode->i_ino); + pr_debug("get_link(ino=%llu)\n", inode->i_ino); bh = affs_bread(inode->i_sb, inode->i_ino); if (!bh) |
