[PATCH 31/61] ext2: update format strings for u64 i_ino

Jeff Layton
2026-02-26T16:02:47Z

Update format strings and local variable types in ext2 for the
i_ino type change from unsigned long to u64.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ext2/dir.c | 10 +++++-----
fs/ext2/ialloc.c | 9 +++++----
fs/ext2/inode.c | 2 +-
fs/ext2/xattr.c | 14 +++++++-------
4 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 395fc36c089b7bb6360a8326727bd5606c7e2476..278d4be8ecbe7790204b5ba985a7ce088fadb181 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -141,7 +141,7 @@ static bool ext2_check_folio(struct folio *folio, int quiet, char *kaddr)
Ebadsize:
if (!quiet)
ext2_error(sb, __func__,
- "size of directory #%lu is not a multiple "
+ "size of directory #%llu is not a multiple "
"of chunk size", dir->i_ino);
goto fail;
Eshort:
@@ -160,7 +160,7 @@ static bool ext2_check_folio(struct folio *folio, int quiet, char *kaddr)
error = "inode out of bounds";
bad_entry:
if (!quiet)
- ext2_error(sb, __func__, "bad entry in directory #%lu: : %s - "
+ ext2_error(sb, __func__, "bad entry in directory #%llu: : %s - "
"offset=%llu, inode=%lu, rec_len=%d, name_len=%d",
dir->i_ino, error, folio_pos(folio) + offs,
(unsigned long) le32_to_cpu(p->inode),
@@ -170,7 +170,7 @@ static bool ext2_check_folio(struct folio *folio, int quiet, char *kaddr)
if (!quiet) {
p = (ext2_dirent *)(kaddr + offs);
ext2_error(sb, "ext2_check_folio",
- "entry in directory #%lu spans the page boundary"
+ "entry in directory #%llu spans the page boundary"
"offset=%llu, inode=%lu",
dir->i_ino, folio_pos(folio) + offs,
(unsigned long) le32_to_cpu(p->inode));
@@ -281,7 +281,7 @@ ext2_readdir(struct file *file, struct dir_context *ctx)

if (IS_ERR(kaddr)) {
ext2_error(sb, __func__,
- "bad page in #%lu",
+ "bad page in #%llu",
inode->i_ino);
ctx->pos += PAGE_SIZE - offset;
return PTR_ERR(kaddr);
@@ -383,7 +383,7 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
/* next folio is past the blocks we've got */
if (unlikely(n > (dir->i_blocks >> (PAGE_SHIFT - 9)))) {
ext2_error(dir->i_sb, __func__,
- "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;
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index fdf63e9c6e7caa6d5267c25faa6c293622f00627..bf21b57cf98cd5f90e1177454a8fd5cca482c2f8 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -169,9 +169,10 @@ static void ext2_preread_inode(struct inode *inode)
unsigned long block_group;
unsigned long offset;
unsigned long block;
+ unsigned int ino = inode->i_ino;
struct ext2_group_desc * gdp;

- block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
+ block_group = (ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
gdp = ext2_get_group_desc(inode->i_sb, block_group, NULL);
if (gdp == NULL)
return;
@@ -179,7 +180,7 @@ static void ext2_preread_inode(struct inode *inode)
/*
* Figure out the offset within the block group inode table
*/
- offset = ((inode->i_ino - 1) % EXT2_INODES_PER_GROUP(inode->i_sb)) *
+ offset = ((ino - 1) % EXT2_INODES_PER_GROUP(inode->i_sb)) *
EXT2_INODE_SIZE(inode->i_sb);
block = le32_to_cpu(gdp->bg_inode_table) +
(offset >> EXT2_BLOCK_SIZE_BITS(inode->i_sb));
@@ -381,7 +382,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
*
* So add our directory's i_ino into the starting point for the hash.
*/
- group = (group + parent->i_ino) % ngroups;
+ group = (group + (unsigned int)parent->i_ino) % ngroups;

/*
* Use a quadratic hash to find a group with a free inode and some
@@ -589,7 +590,7 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
goto fail_free_drop;

mark_inode_dirty(inode);
- ext2_debug("allocating inode %lu\n", inode->i_ino);
+ ext2_debug("allocating inode %llu\n", inode->i_ino);
ext2_preread_inode(inode);
return inode;

diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index dbfe9098a1245d97ba97cff24395754197043c33..819fa81901b79e0ef4e01e428445bd8d8cc01e68 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1152,7 +1152,7 @@ static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int de
*/
if (!bh) {
ext2_error(inode->i_sb, "ext2_free_branches",
- "Read failure, inode=%ld, block=%ld",
+ "Read failure, inode=%lld, block=%ld",
inode->i_ino, nr);
continue;
}
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index c885dcc3bd0d180c4c3f0945ca23ed8ce569ef10..e7f87d1514458f14252702119e1c065a28ea3d73 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -227,7 +227,7 @@ ext2_xattr_get(struct inode *inode, int name_index, const char *name,
if (!ext2_xattr_header_valid(HDR(bh))) {
bad_block:
ext2_error(inode->i_sb, "ext2_xattr_get",
- "inode %ld: bad block %d", inode->i_ino,
+ "inode %llu: bad block %d", inode->i_ino,
EXT2_I(inode)->i_file_acl);
error = -EIO;
goto cleanup;
@@ -313,7 +313,7 @@ ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
if (!ext2_xattr_header_valid(HDR(bh))) {
bad_block:
ext2_error(inode->i_sb, "ext2_xattr_list",
- "inode %ld: bad block %d", inode->i_ino,
+ "inode %llu: bad block %d", inode->i_ino,
EXT2_I(inode)->i_file_acl);
error = -EIO;
goto cleanup;
@@ -454,7 +454,7 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
if (!ext2_xattr_header_valid(header)) {
bad_block:
ext2_error(sb, "ext2_xattr_set",
- "inode %ld: bad block %d", inode->i_ino,
+ "inode %llu: bad block %d", inode->i_ino,
EXT2_I(inode)->i_file_acl);
error = -EIO;
goto cleanup;
@@ -833,7 +833,7 @@ ext2_xattr_delete_inode(struct inode *inode)

if (!ext2_data_block_valid(sbi, EXT2_I(inode)->i_file_acl, 1)) {
ext2_error(inode->i_sb, "ext2_xattr_delete_inode",
- "inode %ld: xattr block %d is out of data blocks range",
+ "inode %lld: xattr block %d is out of data blocks range",
inode->i_ino, EXT2_I(inode)->i_file_acl);
goto cleanup;
}
@@ -841,14 +841,14 @@ ext2_xattr_delete_inode(struct inode *inode)
bh = sb_bread(inode->i_sb, EXT2_I(inode)->i_file_acl);
if (!bh) {
ext2_error(inode->i_sb, "ext2_xattr_delete_inode",
- "inode %ld: block %d read error", inode->i_ino,
+ "inode %llu: block %d read error", inode->i_ino,
EXT2_I(inode)->i_file_acl);
goto cleanup;
}
ea_bdebug(bh, "b_count=%d", atomic_read(&(bh->b_count)));
if (!ext2_xattr_header_valid(HDR(bh))) {
ext2_error(inode->i_sb, "ext2_xattr_delete_inode",
- "inode %ld: bad block %d", inode->i_ino,
+ "inode %llu: bad block %d", inode->i_ino,
EXT2_I(inode)->i_file_acl);
goto cleanup;
}
@@ -952,7 +952,7 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
bh = sb_bread(inode->i_sb, ce->e_value);
if (!bh) {
ext2_error(inode->i_sb, "ext2_xattr_cache_find",
- "inode %ld: block %ld read error",
+ "inode %lld: block %ld read error",
inode->i_ino, (unsigned long) ce->e_value);
} else {
lock_buffer(bh);

--
2.53.0